Changeset 12971 for main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
- Timestamp:
- 21 May 2015, 07:38:15 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r12873 r12971 86 86 return tickets 87 87 88 def get_payments(students, p aid=False, **kw):88 def get_payments(students, p_state=None, **kw): 89 89 """Get all payments of `students` within given payment_date period. 90 90 """ … … 100 100 payments_start = tz.localize(payments_start) 101 101 payments_end = tz.localize(payments_end) 102 if p aid:103 # Only paid tickets in payment period are considered102 if p_state: 103 # Only paid or unpaid tickets in payment period are considered 104 104 for student in students: 105 105 for payment in student.get('payments', {}).values(): 106 if payment.payment_date and payment.p_state == 'paid':106 if payment.payment_date and payment.p_state == p_state: 107 107 payment_date = to_timezone(payment.payment_date, tz) 108 108 if payment_date > payments_start and \ … … 120 120 else: 121 121 # Payment period not given 122 if p aid:122 if p_state: 123 123 # Only paid tickets are considered 124 124 for student in students: 125 125 for payment in student.get('payments', {}).values(): 126 if payment.p_state == 'paid':126 if payment.p_state == p_state: 127 127 payments.append(payment) 128 128 else: … … 382 382 value, name, context=context) 383 383 384 class StudentUnpaidPaymentExporter(StudentPaymentExporter): 385 """The Student Unpaid Payment Exporter works just like the 386 Student Payments Exporter but it exports only unpaid tickets. 387 This exporter is designed for finding and finally purging outdated 388 payment ticket. 389 """ 390 grok.name('studentunpaidpayments') 391 392 title = _(u'Student Unpaid Payments') 393 394 def filter_func(self, x, **kw): 395 return get_payments(x, p_state='unpaid', **kw) 396 384 397 class DataForBursaryExporter(StudentPaymentExporter): 385 398 """The DataForBursary Exporter works just like the Student Payments Exporter … … 392 405 393 406 def filter_func(self, x, **kw): 394 return get_payments(x, p aid=True, **kw)407 return get_payments(x, p_state='paid', **kw) 395 408 396 409 fields = tuple(
Note: See TracChangeset for help on using the changeset viewer.