- Timestamp:
- 15 Nov 2018, 07:43:48 (6 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r15206 r15243 4 4 1.6.1.dev0 (unreleased) 5 5 ======================= 6 7 * Fix get_student_payment_stats. Department codes are not 8 unique. Use its path instead. 6 9 7 10 * Implement study level 0 (Level Zero) option for storing -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15213 r15243 3298 3298 def _searchCatalog(self, session): 3299 3299 cat = queryUtility(ICatalog, name='coursetickets_catalog') 3300 # Attention: Also tickets of previous studycourses are found 3300 3301 coursetickets = cat.searchResults( 3301 3302 session=(session, session), … … 3442 3443 def data(self, session): 3443 3444 cat = queryUtility(ICatalog, name='coursetickets_catalog') 3445 # Attention: Also tickets of previous studycourses are found 3444 3446 coursetickets = cat.searchResults( 3445 3447 session=(session, session), -
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_payment_statistics.py
r15081 r15243 62 62 payment_cats = tuple(sorted(payment_cats_dict.keys())) + ('Total',) 63 63 if breakdown == 'faccode': 64 codes = tuple(sorted([x for x in site['faculties'].keys()],64 paths = tuple(sorted([x for x in site['faculties'].keys()], 65 65 key=lambda x: x.lower())) 66 paths = codes67 66 elif breakdown == 'depcode': 68 67 faculties = site['faculties'] 69 depcodes = []70 68 deppaths = [] 71 69 for fac in faculties.values(): 72 70 for dep in fac.values(): 73 depcodes.append(dep.code)74 71 deppaths.append('%s/%s' % (fac.code, dep.code)) 75 codes = tuple(sorted([x for x in depcodes],76 key=lambda x: x.lower()))77 72 paths = tuple(sorted([x for x in deppaths], 78 73 key=lambda x: x.lower())) … … 87 82 result = cat.searchResults(current_session=(session, session)) 88 83 table = [[0 for x in xrange(2*len(payment_cats))] 89 for y in xrange(len( codes)+1)]84 for y in xrange(len(paths)+1)] 90 85 mode_groups = getUtility(IKofaUtils).MODE_GROUPS 91 86 for stud in result: … … 97 92 if entry_session != 0 and stud.entry_session != entry_session: 98 93 continue 99 if getattr(stud, breakdown) not in codes: 100 # studs can have a faccode ``None`` 101 continue 102 row = codes.index(getattr(stud, breakdown)) 94 if breakdown == 'faccode': 95 if getattr(stud, 'faccode') not in paths: 96 # studs can have a faccode ``None`` 97 continue 98 # Dep codes are not unique. 99 if breakdown == 'depcode': 100 row = paths.index( 101 '%s/%s' % (getattr(stud, 'faccode'), getattr(stud, 'depcode'))) 102 else: 103 row = paths.index(getattr(stud, breakdown)) 103 104 for key in stud['payments'].keys(): 104 105 ticket = stud['payments'][key] -
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_payment_statistics.py
r14513 r15243 53 53 return 54 54 55 def test_create_pdf (self):55 def test_create_pdf_1(self): 56 56 report = StudentPaymentStatisticsReport( 57 57 2010, 'Undergraduate Full-Time', 0, 0, 0, 'faccode') 58 58 result = report.create_pdf('JOB_ID') 59 59 self.assertTrue(result.startswith('%PDF-')) 60 path = os.path.join(samples_dir(), 'student_payment_statistics .pdf')60 path = os.path.join(samples_dir(), 'student_payment_statistics_faccode.pdf') 61 61 open(path, 'wb').write(result) 62 print "Sample PDF student_statistics.pdf written to %s" % path 62 print "Sample PDF student_statistics_faccode.pdf written to %s" % path 63 return 64 65 def test_create_pdf_2(self): 66 report = StudentPaymentStatisticsReport( 67 2010, 'Undergraduate Full-Time', 0, 0, 0, 'depcode') 68 result = report.create_pdf('JOB_ID') 69 self.assertTrue(result.startswith('%PDF-')) 70 path = os.path.join(samples_dir(), 'student_payment_statistics_depcode.pdf') 71 open(path, 'wb').write(result) 72 print "Sample PDF student_statistics_depcode.pdf written to %s" % path 63 73 return 64 74
Note: See TracChangeset for help on using the changeset viewer.