(cls, username)
return {'request_count': req_count, 'created_bins': len(uuids)}
Returns statistics for user :O
Returns statistics for user :O
Returns statistics for user : O
def statistics_count(cls, username):
        """
        Returns statistics for user :O
        """
        def get_count(q):
            """
            Used for counting rows because SQLAlchemys count is slow af
            """
            count_q = q.statement.with_only_columns([func.count()]).order_by(None)
            count = q.session.execute(count_q).scalar()
            return count
        uuids = [x['uuid'] for x in DnsModel.find_by_user(username)]
        req_count = 0

        for uuid in uuids:
            req_count += get_count(cls.query.filter_by(uuid = uuid))

        return {'request_count': req_count, 'created_bins': len(uuids)}
def statistics_count ( cls , username ) : def get_count ( q ) : """
            Used for counting rows because SQLAlchemys count is slow af
            """ count_q = q . statement . with_only_columns ( [ func . count ( ) ] ) . order_by ( None ) count = q . session . execute ( count_q ) . scalar ( ) return count uuids = [ x [ 'uuid' ] for x in DnsModel . find_by_user ( username ) ] req_count = 0 for uuid in uuids : req_count += get_count ( cls . query . filter_by ( uuid = uuid ) ) return { 'request_count' : req_count , 'created_bins' : len ( uuids ) }