Changeset 11757
- Timestamp:
- 10 Jul 2014, 12:20:30 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r11756 r11757 22 22 from datetime import datetime 23 23 from zope.component import getUtility 24 from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser 24 from waeup.kofa.interfaces import ( 25 IExtFileStore, IFileStoreNameChooser, IKofaUtils) 25 26 from waeup.kofa.interfaces import MessageFactory as _ 26 27 from waeup.kofa.students.catalog import StudentsQuery, CourseTicketsQuery … … 30 31 from waeup.kofa.students.vocabularies import study_levels 31 32 from waeup.kofa.utils.batching import ExporterBase 32 from waeup.kofa.utils.helpers import iface_names 33 from waeup.kofa.utils.helpers import iface_names, to_timezone 33 34 34 35 #: A tuple containing all exporter names referring to students or … … 104 105 payments_start = datetime.strptime(payments_start, date_format) 105 106 payments_end = datetime.strptime(payments_end, date_format) 107 tz = getUtility(IKofaUtils).tzinfo 108 payments_start = tz.localize(payments_start) 109 payments_end = tz.localize(payments_end) 106 110 if paid: 107 111 # Only paid tickets in payment period are considered 108 112 for student in students: 109 113 for payment in student.get('payments', {}).values(): 110 if payment.payment_date and payment.p_state == 'paid' and \ 111 payment.payment_date > payments_start and \ 112 payment.payment_date < payments_end: 113 payments.append(payment) 114 if payment.payment_date and payment.p_state == 'paid': 115 payment_date = to_timezone(payment.payment_date, tz) 116 if payment_date > payments_start and \ 117 payment_date < payments_end: 118 payments.append(payment) 114 119 else: 115 120 # All tickets in payment period are considered 116 121 for student in students: 117 122 for payment in student.get('payments', {}).values(): 118 if payment.payment_date and payment.payment_date > payments_start and \ 119 payment.payment_date < payments_end: 120 payments.append(payment) 123 if payment.payment_date: 124 payment_date = to_timezone(payment.payment_date, tz) 125 if payment_date > payments_start and \ 126 payment_date < payments_end: 127 payments.append(payment) 121 128 else: 122 129 # Payment period not given
Note: See TracChangeset for help on using the changeset viewer.