def get_stats(self): cnds = self.navb.conditions() #print "CNDS: ", cnds attrs = [(x.indexcol, x.code.lower(), x.name) for x in Enduser.get_roles()] cols = ['COUNT(*) AS total'] exts = {} for attr in attrs: exts.update( {attr[1].lower(): ('COUNT(*)', 'role_pk = %d' % attr[0])}) nat = Enduser.get_users_summary(cnds, cols, exts) avg = average return [attrs, avg, nat]
def get_total(self): cnds = self.navb.conditions() exts = {} cols = ['COUNT(*) AS total'] total = Enduser.get_users_summary(cnds, cols, exts)[0] return total