Changeset 13236 for main/waeup.kofa/trunk
- Timestamp:
- 3 Sep 2015, 15:12:03 (9 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r13223 r13236 4 4 1.3.2.dev0 (unreleased) 5 5 ======================= 6 7 * Fix department breakdown of student statistics. 6 8 7 9 * Enable purging of applicants containers. -
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_statistics.py
r12913 r13236 40 40 Returns a table ordered by code (faculty or department, one per row) and 41 41 registration state (cols). The result is a 3-tuple representing 42 ((< CODES>), (<STATES>), (<NUM_OF_STUDENTS>)). The42 ((<PATHS>), (<STATES>), (<NUM_OF_STUDENTS>)). The 43 43 (<NUM_OF_STUDENTS>) is an n-tuple with each entry containing the 44 44 number of students found in that faculty/department and with the respective … … 58 58 states = states + (u'Total',) 59 59 if breakdown == 'faccode': 60 codes = tuple(sorted([x for x in site['faculties'].keys()],60 paths = tuple(sorted([x for x in site['faculties'].keys()], 61 61 key=lambda x: x.lower())) 62 paths = codes63 62 elif breakdown == 'depcode': 64 63 faculties = site['faculties'] 65 depcodes = []66 64 deppaths = [] 67 65 for fac in faculties.values(): 68 66 for dep in fac.values(): 69 depcodes.append(dep.code)70 67 deppaths.append('%s/%s' % (fac.code, dep.code)) 71 codes = tuple(sorted([x for x in depcodes],72 key=lambda x: x.lower()))73 68 paths = tuple(sorted([x for x in deppaths], 74 69 key=lambda x: x.lower())) … … 79 74 cat = queryUtility(ICatalog, name="students_catalog") 80 75 result = cat.searchResults(current_session=(session, session)) 81 table = [[0 for x in xrange(len(states))] for y in xrange(len( codes)+1)]76 table = [[0 for x in xrange(len(states))] for y in xrange(len(paths)+1)] 82 77 mode_groups = getUtility(IKofaUtils).MODE_GROUPS 83 78 for stud in result: … … 86 81 if level != 0 and stud.current_level != level: 87 82 continue 88 if getattr(stud, breakdown) not in codes: 89 # studs can have a faccode ``None`` 83 if getattr(stud, breakdown) is None: 90 84 continue 91 row = codes.index(getattr(stud, breakdown)) 85 if breakdown == 'faccode': 86 row_name = getattr(stud, 'faccode') 87 elif breakdown == 'depcode': 88 row_name = '%s/%s' % ( 89 getattr(stud, 'faccode'), getattr(stud, 'depcode')) 90 row = paths.index(row_name) 92 91 col = states.index(stud.state) 93 92 table[row][col] += 1
Note: See TracChangeset for help on using the changeset viewer.