Changeset 15924 for main/waeup.kofa/trunk
- Timestamp:
- 14 Jan 2020, 09:35:37 (5 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/docs/source/userdocs/datacenter/export.rst
r15918 r15924 221 221 .. automethod:: waeup.kofa.students.export.CourseTicketExporter.mangle_value() 222 222 223 Student Outstanding Courses Exporter224 ------------------------------------225 226 .. autoclass:: waeup.kofa.students.export.StudentOutstandingCoursesExporter()227 228 .. autoattribute:: waeup.kofa.students.export.StudentOutstandingCoursesExporter.fields229 .. autoattribute:: waeup.kofa.students.export.StudentOutstandingCoursesExporter.title230 .. automethod:: waeup.kofa.students.export.StudentOutstandingCoursesExporter.mangle_value()231 232 223 Student Payment Exporter 233 224 ------------------------ … … 238 229 .. autoattribute:: waeup.kofa.students.export.StudentPaymentExporter.title 239 230 .. automethod:: waeup.kofa.students.export.StudentPaymentExporter.mangle_value() 240 241 Student Unpaid Payment Exporter242 -------------------------------243 244 .. autoclass:: waeup.kofa.students.export.StudentUnpaidPaymentExporter()245 246 .. autoattribute:: waeup.kofa.students.export.StudentUnpaidPaymentExporter.title247 231 248 232 Bed Ticket Exporter … … 265 249 postprocessing by the university. 266 250 251 Outstanding Courses Exporter 252 ---------------------------- 253 254 .. autoclass:: waeup.kofa.students.export.OutstandingCoursesExporter() 255 256 .. autoattribute:: waeup.kofa.students.export.OutstandingCoursesExporter.fields 257 .. autoattribute:: waeup.kofa.students.export.OutstandingCoursesExporter.title 258 .. automethod:: waeup.kofa.students.export.OutstandingCoursesExporter.mangle_value() 259 267 260 Data For Bursary Exporter 268 261 ------------------------- … … 273 266 .. autoattribute:: waeup.kofa.students.export.DataForBursaryExporter.title 274 267 .. automethod:: waeup.kofa.students.export.DataForBursaryExporter.mangle_value() 268 269 Unpaid Payments Exporter 270 ------------------------ 271 272 .. autoclass:: waeup.kofa.students.export.UnpaidPaymentsExporter() 273 274 .. autoattribute:: waeup.kofa.students.export.UnpaidPaymentsExporter.title 275 275 276 276 Accommodation Payments Exporter … … 302 302 .. automethod:: waeup.kofa.students.export.SessionPaymentsOverviewExporter.mangle_value() 303 303 304 Stud ent Study Levels Overview Exporter305 ------------------------------ --------306 307 .. autoclass:: waeup.kofa.students.export.Stud entStudyLevelsOverviewExporter()308 309 .. autoattribute:: waeup.kofa.students.export.Stud entStudyLevelsOverviewExporter.fields310 .. autoattribute:: waeup.kofa.students.export.Stud entStudyLevelsOverviewExporter.title311 .. automethod:: waeup.kofa.students.export.Stud entStudyLevelsOverviewExporter.mangle_value()304 Study Levels Overview Exporter 305 ------------------------------ 306 307 .. autoclass:: waeup.kofa.students.export.StudyLevelsOverviewExporter() 308 309 .. autoattribute:: waeup.kofa.students.export.StudyLevelsOverviewExporter.fields 310 .. autoattribute:: waeup.kofa.students.export.StudyLevelsOverviewExporter.title 311 .. automethod:: waeup.kofa.students.export.StudyLevelsOverviewExporter.mangle_value() 312 312 313 313 Combo Card Data Exporter … … 328 328 .. autoattribute:: waeup.kofa.students.export.DataForLecturerExporter.title 329 329 .. automethod:: waeup.kofa.students.export.DataForLecturerExporter.mangle_value() 330 331 Transcript Data Exporter 332 ------------------------ 333 334 .. autoclass:: waeup.kofa.students.export.TranscriptDataExporter() 335 336 .. autoattribute:: waeup.kofa.students.export.TranscriptDataExporter.fields 337 .. autoattribute:: waeup.kofa.students.export.TranscriptDataExporter.title 338 .. automethod:: waeup.kofa.students.export.TranscriptDataExporter.mangle_value() 330 339 331 340 File Export -
main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
r15921 r15924 164 164 165 165 def get_payments(students, p_states=None, **kw): 166 """Get all payment s of `students` within given payment_date period.166 """Get all payment tickets of `students` within given payment_date period. 167 167 """ 168 168 date_format = '%d/%m/%Y' … … 196 196 197 197 def get_bedtickets(students): 198 """Get all bed tickets of `students`.198 """Get all bed tickets of `students`. 199 199 """ 200 200 tickets = [] … … 436 436 value, name, context=context) 437 437 438 class StudentPaymentExporter(grok.GlobalUtility, StudentExporterBase): 439 """The Student Payment Exporter first filters the set of students 440 by searching the students catalog. Then it exports student payment 441 tickets by iterating over the items of the student's ``payments`` 442 container. If the payment period is given, only tickets, which were 443 paid in payment period, are considered for export. 444 """ 445 grok.name('studentpayments') 446 447 fields = tuple( 448 sorted(iface_names( 449 IStudentOnlinePayment, exclude_attribs=False, 450 omit=['display_item', 'certificate', 'student']))) + ( 451 'student_id','state','current_session') 452 title = _(u'Student Payments (Data Backup)') 453 454 def filter_func(self, x, **kw): 455 return get_payments(x, **kw) 456 457 def mangle_value(self, value, name, context=None): 458 """The mangler determines the student's id, registration 459 state and current session. 460 """ 461 if context is not None: 462 student = context.student 463 if name in ['student_id','state', 464 'current_session'] and student is not None: 465 value = getattr(student, name, None) 466 return super( 467 StudentPaymentExporter, self).mangle_value( 468 value, name, context=context) 469 438 470 class DataForLecturerExporter(grok.GlobalUtility, StudentExporterBase): 439 471 """The Data for Lecturer Exporter searches for students in the course … … 467 499 value, name, context=context) 468 500 469 class StudentOutstandingCoursesExporter(grok.GlobalUtility, StudentExporterBase):501 class OutstandingCoursesExporter(grok.GlobalUtility, StudentExporterBase): 470 502 """The Student Outstanding Courses Exporter first filters the set of 471 503 students by searching the students catalog. Then it exports students with … … 497 529 value = context[3] 498 530 return super( 499 StudentOutstandingCoursesExporter, self).mangle_value( 500 value, name, context=context) 501 502 class StudentPaymentExporter(grok.GlobalUtility, StudentExporterBase): 503 """The Student Payment Exporter first filters the set of students 504 by searching the students catalog. Then it exports student payment 505 tickets by iterating over the items of the student's ``payments`` 506 container. If the payment period is given, only tickets, which were 507 paid in payment period, are considered for export. 508 """ 509 grok.name('studentpayments') 510 511 fields = tuple( 512 sorted(iface_names( 513 IStudentOnlinePayment, exclude_attribs=False, 514 omit=['display_item', 'certificate', 'student']))) + ( 515 'student_id','state','current_session') 516 title = _(u'Student Payments (Data Backup)') 517 518 def filter_func(self, x, **kw): 519 return get_payments(x, **kw) 520 521 def mangle_value(self, value, name, context=None): 522 """The mangler determines the student's id, registration 523 state and current session. 524 """ 525 if context is not None: 526 student = context.student 527 if name in ['student_id','state', 528 'current_session'] and student is not None: 529 value = getattr(student, name, None) 530 return super( 531 StudentPaymentExporter, self).mangle_value( 532 value, name, context=context) 533 534 class StudentUnpaidPaymentExporter(StudentPaymentExporter): 535 """The Student Unpaid Payment Exporter works just like the 536 Student Payments Exporter but it exports only unpaid tickets. 537 This exporter is designed for finding and finally purging outdated 538 payment ticket. 531 OutstandingCoursesExporter, self).mangle_value( 532 value, name, context=context) 533 534 class UnpaidPaymentsExporter(StudentPaymentExporter): 535 """The Unpaid Payments Exporter works just like the 536 Student Payment (singular intended) Exporter but it exports only 537 unpaid tickets. This exporter is designed for finding and finally 538 purging outdated payment tickets. 539 539 """ 540 540 grok.name('unpaidpayments') … … 838 838 839 839 def mangle_value(self, value, name, context=None): 840 """The mangler determines the trascript data.840 """The mangler determines and formats the transcript data. 841 841 """ 842 842 if name == 'transcript_data': -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r15921 r15924 34 34 SchoolFeePaymentsOverviewExporter, StudyLevelsOverviewExporter, 35 35 ComboCardDataExporter, DataForBursaryExporter, 36 StudentUnpaidPaymentExporter, SessionPaymentsOverviewExporter,37 StudentOutstandingCoursesExporter,36 UnpaidPaymentsExporter, SessionPaymentsOverviewExporter, 37 OutstandingCoursesExporter, 38 38 AccommodationPaymentsExporter, 39 39 TranscriptDataExporter, … … 797 797 return 798 798 799 class StudentOutstandingCoursesExporterTest(StudentImportExportSetup):799 class OutstandingCoursesExporterTest(StudentImportExportSetup): 800 800 801 801 layer = FunctionalLayer 802 802 803 803 def setUp(self): 804 super( StudentOutstandingCoursesExporterTest, self).setUp()804 super(OutstandingCoursesExporterTest, self).setUp() 805 805 self.setup_for_export() 806 806 return … … 808 808 def test_ifaces(self): 809 809 # make sure we fullfill interface contracts 810 obj = StudentOutstandingCoursesExporter()810 obj = OutstandingCoursesExporter() 811 811 verifyObject(ICSVStudentExporter, obj) 812 verifyClass(ICSVStudentExporter, StudentOutstandingCoursesExporter)812 verifyClass(ICSVStudentExporter, OutstandingCoursesExporter) 813 813 return 814 814 … … 831 831 self.setup_student(self.student) 832 832 self.student['studycourse']['100']['C3'].score = 25 833 exporter = StudentOutstandingCoursesExporter()833 exporter = OutstandingCoursesExporter() 834 834 exporter.export_all(self.app, self.outfile) 835 835 result = open(self.outfile, 'rb').read() … … 1042 1042 return 1043 1043 1044 class StudentUnpaidPaymentExporterTest(StudentImportExportSetup):1044 class UnpaidPaymentsExporterTest(StudentImportExportSetup): 1045 1045 1046 1046 layer = FunctionalLayer 1047 1047 1048 1048 def setUp(self): 1049 super( StudentUnpaidPaymentExporterTest, self).setUp()1049 super(UnpaidPaymentsExporterTest, self).setUp() 1050 1050 self.setup_for_export() 1051 1051 return … … 1055 1055 # set values we can expect in export file 1056 1056 self.setup_student(self.student) 1057 exporter = StudentUnpaidPaymentExporter()1057 exporter = UnpaidPaymentsExporter() 1058 1058 exporter.export_all(self.app, self.outfile) 1059 1059 result = open(self.outfile, 'rb').read()
Note: See TracChangeset for help on using the changeset viewer.