Changeset 12619 for main/waeup.kofa/trunk/src/waeup/kofa/students/reports
- Timestamp:
- 15 Feb 2015, 08:06:25 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/reports
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_payment_statistics.py
r12564 r12619 59 59 codes = tuple(sorted([x for x in site['faculties'].keys()], 60 60 key=lambda x: x.lower())) 61 paths = codes 61 62 elif breakdown == 'depcode': 62 63 faculties = site['faculties'] 63 64 depcodes = [] 65 deppaths = [] 64 66 for fac in faculties.values(): 65 67 for dep in fac.values(): 66 68 depcodes.append(dep.code) 69 deppaths.append('%s/%s' % (fac.code, dep.code)) 67 70 codes = tuple(sorted([x for x in depcodes], 68 71 key=lambda x: x.lower())) 69 codes = codes + (u'Total',) 72 paths = tuple(sorted([x for x in deppaths], 73 key=lambda x: x.lower())) 70 74 # XXX: Here we do _one_ query and then examine the single 71 75 # students. One could also do multiple queries and just look for … … 74 78 cat = queryUtility(ICatalog, name="students_catalog") 75 79 result = cat.searchResults(current_session=(session, session)) 76 table = [[0 for x in xrange(2*len(payment_cats))] for y in xrange(len(codes) )]80 table = [[0 for x in xrange(2*len(payment_cats))] for y in xrange(len(codes)+1)] 77 81 mode_groups = getUtility(IKofaUtils).MODE_GROUPS 78 82 for stud in result: … … 115 119 # Turn lists into tuples 116 120 table = tuple([tuple(row) for row in table]) 117 return (codes, table_header, table) 121 122 paths = paths + (u'Total',) 123 return (paths, table_header, table) 118 124 119 125 from reportlab.lib import colors -
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_statistics.py
r12515 r12619 57 57 codes = tuple(sorted([x for x in site['faculties'].keys()], 58 58 key=lambda x: x.lower())) 59 paths = codes 59 60 elif breakdown == 'depcode': 60 61 faculties = site['faculties'] 61 62 depcodes = [] 63 deppaths = [] 62 64 for fac in faculties.values(): 63 65 for dep in fac.values(): 64 66 depcodes.append(dep.code) 67 deppaths.append('%s/%s' % (fac.code, dep.code)) 65 68 codes = tuple(sorted([x for x in depcodes], 66 69 key=lambda x: x.lower())) 67 codes = codes + (u'Total',) 70 paths = tuple(sorted([x for x in deppaths], 71 key=lambda x: x.lower())) 68 72 # XXX: Here we do _one_ query and then examine the single 69 73 # students. One could also do multiple queries and just look for … … 72 76 cat = queryUtility(ICatalog, name="students_catalog") 73 77 result = cat.searchResults(current_session=(session, session)) 74 table = [[0 for x in xrange(len(states))] for y in xrange(len(codes) )]78 table = [[0 for x in xrange(len(states))] for y in xrange(len(codes)+1)] 75 79 mode_groups = getUtility(IKofaUtils).MODE_GROUPS 76 80 for stud in result: … … 88 92 # turn lists into tuples 89 93 table = tuple([tuple(row) for row in table]) 90 return (codes, states, table) 94 95 paths = paths + (u'Total',) 96 return (paths, states, table) 91 97 92 98 from reportlab.lib import colors -
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_statistics.py
r12515 r12619 76 76 self.assertEqual( 77 77 result1, 78 ((u' dep1', u'dep2', u'Total'),78 ((u'fac1/dep1', u'fac2/dep2', u'Total'), 79 79 self.states, 80 80 ((1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), … … 83 83 self.assertEqual( 84 84 result2, 85 ((u' dep1', u'dep2', u'Total'),85 ((u'fac1/dep1', u'fac2/dep2', u'Total'), 86 86 self.states, 87 87 ((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
Note: See TracChangeset for help on using the changeset viewer.