Changeset 14761 for main/waeup.kofa/trunk/src
- Timestamp:
- 3 Aug 2017, 12:43:47 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r14596 r14761 114 114 return tickets 115 115 116 def get_payments(students, p_state =None, **kw):116 def get_payments(students, p_states=None, **kw): 117 117 """Get all payments of `students` within given payment_date period. 118 118 """ … … 128 128 payments_start = tz.localize(payments_start) 129 129 payments_end = tz.localize(payments_end) + timedelta(days=1) 130 if p_state :131 # Only paid or unpaid tickets inpayment period are considered130 if p_states: 131 # Only tickets in certain states and payment period are considered 132 132 for student in students: 133 133 for payment in student.get('payments', {}).values(): 134 if payment.payment_date and payment.p_state == p_state:134 if payment.payment_date and payment.p_state in p_states: 135 135 payment_date = to_timezone(payment.payment_date, tz) 136 136 if payment_date > payments_start and \ … … 148 148 else: 149 149 # Payment period not given 150 if p_state :150 if p_states: 151 151 # Only paid tickets are considered 152 152 for student in students: 153 153 for payment in student.get('payments', {}).values(): 154 if payment.p_state == p_state:154 if payment.p_state in p_states: 155 155 payments.append(payment) 156 156 else: … … 453 453 454 454 def filter_func(self, x, **kw): 455 return get_payments(x, p_state ='unpaid', **kw)455 return get_payments(x, p_states=('unpaid',) , **kw) 456 456 457 457 class DataForBursaryExporter(StudentPaymentExporter): … … 460 460 payment and student data in one table in order to spare postprocessing of 461 461 two seperate export files. The exporter is primarily used by bursary 462 officers who have exclusively access to this exporter. 462 officers who have exclusively access to this exporter. The exporter 463 exports ``paid`` and ``waived`` payment tickets. 463 464 """ 464 465 grok.name('bursary') 465 466 466 467 def filter_func(self, x, **kw): 467 return get_payments(x, p_state ='paid', **kw)468 return get_payments(x, p_states=('paid', 'waived'), **kw) 468 469 469 470 fields = tuple(
Note: See TracChangeset for help on using the changeset viewer.