Changeset 16828 for main/waeup.kofa/trunk
- Timestamp:
- 22 Feb 2022, 22:08:37 (3 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r16827 r16828 4 4 1.7.2.dev0 (unreleased) 5 5 ======================= 6 7 * Add importers for previous study course data. 6 8 7 9 * Add exporters for previous study course data. -
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r16821 r16828 485 485 iface_transfer = IStudentStudyCourseTransfer 486 486 factory_name = 'waeup.StudentStudyCourse' 487 studycourse_name = 'studycourse' 487 488 488 489 def getParent(self, row, site): … … 493 494 if student is None: 494 495 return None 495 return student.get( 'studycourse')496 return student.get(self.studycourse_name) 496 497 497 498 def updateEntry(self, obj, row, site, filename): … … 508 509 student.transfer( 509 510 certificate=certificate, current_session=current_session) 510 obj = student['studycourse'] 511 obj = student[self.studycourse_name] 512 # Once imported we must ensure that after export and reimport 513 # the student is not transferred again. 514 row['entry_mode'] = 'transferred' 511 515 items_changed = super(StudentStudyCourseProcessor, self).updateEntry( 512 516 obj, row, site, filename) … … 585 589 iface = IStudentStudyLevel 586 590 factory_name = 'waeup.StudentStudyLevel' 591 studycourse_name = 'studycourse' 587 592 588 593 additional_fields_required = ['level'] … … 599 604 if student is None: 600 605 return None 601 return student[ 'studycourse']606 return student[self.studycourse_name] 602 607 603 608 def getEntry(self, row, site): … … 702 707 iface = ICourseTicketImport 703 708 factory_name = 'waeup.CourseTicket' 709 studycourse_name = 'studycourse' 704 710 705 711 additional_fields = ['level', 'code'] … … 721 727 if student is None: 722 728 return None 723 return student[ 'studycourse'].get(str(row['level']))729 return student[self.studycourse_name].get(str(row['level'])) 724 730 725 731 def getEntry(self, row, site): … … 1079 1085 notify(grok.ObjectModifiedEvent(obj.__parent__)) 1080 1086 return 1087 1088 class FirstStudentStudyCourseProcessor(StudentStudyCourseProcessor): 1089 """The First Student Study Course Processor imports first 1090 study course data of students who have been transferred. 1091 """ 1092 util_name = 'studycourseprocessor_1' 1093 grok.name(util_name) 1094 name = _('FirstStudentStudyCourse Processor') 1095 studycourse_name = 'studycourse_1' 1096 1097 def addEntry(self, obj, row, site): 1098 parent = self.getParent(row, site) 1099 parent[self.studycourse_name] = obj 1100 return 1101 1102 class FirstStudentStudyLevelProcessor(StudentStudyLevelProcessor): 1103 """The First Student Study Level Processor imports study level data 1104 into first study course containers of students who have been transferred. 1105 """ 1106 util_name = 'studylevelprocessor_1' 1107 grok.name(util_name) 1108 name = _('FirstStudentStudyLevel Processor') 1109 studycourse_name = 'studycourse_1' 1110 1111 class FirstCourseTicketProcessor(CourseTicketProcessor): 1112 """The First Course Ticket Processor imports course tickets into 1113 first study level containers of students who have been transferred. 1114 """ 1115 util_name = 'courseticketprocessor_1' 1116 grok.name(util_name) 1117 name = _('FirstCourseTicket Processor') 1118 iface = ICourseTicketImport 1119 factory_name = 'waeup.CourseTicket' 1120 studycourse_name = 'studycourse_1' -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r16821 r16828 39 39 StudentProcessor, StudentStudyCourseProcessor, 40 40 StudentStudyLevelProcessor, CourseTicketProcessor, 41 StudentOnlinePaymentProcessor, StudentVerdictProcessor) 41 StudentOnlinePaymentProcessor, StudentVerdictProcessor, 42 FirstStudentStudyCourseProcessor, 43 FirstStudentStudyLevelProcessor, 44 FirstCourseTicketProcessor) 42 45 from waeup.kofa.students.payments import StudentOnlinePayment 43 46 from waeup.kofa.students.student import Student … … 733 736 self.assertEqual(self.student['studycourse'].certificate.code, 'CERT2') 734 737 self.assertEqual(self.student['studycourse_1'].certificate.code, 'CERT1') 735 self.assertEqual(self.student['studycourse'].entry_mode, 'transfer ')738 self.assertEqual(self.student['studycourse'].entry_mode, 'transferred') 736 739 self.assertEqual(self.student['studycourse_1'].entry_mode, 'ug_ft') 737 740 self.assertEqual(self.student.current_mode, 'ug_pt') … … 745 748 'INFO - system - ' 746 749 'StudentStudyCourse Processor (update only) - ' 747 'sample_transfer_data - K1000000 - updated: entry_mode=transfer , '750 'sample_transfer_data - K1000000 - updated: entry_mode=transferred, ' 748 751 'certificate=CERT2, current_session=2009, current_level=300' 749 752 in logcontent) … … 1135 1138 '1,COURSE1,<IGNORE>,300,Cannot remove: no such entry\r\n' 1136 1139 ) 1140 shutil.rmtree(os.path.dirname(fin_file)) 1141 1142 def test_import_firstcourse_with_content(self): 1143 processor = FirstStudentStudyCourseProcessor() 1144 csv_file = os.path.join( 1145 self.workdir, 'sample_studycourse_data.csv') 1146 num, num_warns, fin_file, fail_file = processor.doImport( 1147 csv_file, STUDYCOURSE_HEADER_FIELDS,'create') 1148 self.assertEqual(num_warns,1) 1149 content = open(fail_file).read() 1150 self.assertTrue('current_level: not in range' in content) 1151 studycourse = processor.getEntry(dict(reg_number='1'), self.app) 1152 self.assertEqual(studycourse.certificate.code, u'CERT1') 1153 self.assertEqual(studycourse.__name__, u'studycourse_1') 1154 cat = queryUtility(ICatalog, name='students_catalog') 1155 results = list(cat.searchResults(reg_number=('1', '1'))) 1156 self.assertEqual([i for i in results[0].keys()], 1157 [u'accommodation', u'payments', u'studycourse', u'studycourse_1']) 1158 processor = FirstStudentStudyLevelProcessor() 1159 csv_file = os.path.join( 1160 self.workdir, 'sample_studylevel_data.csv') 1161 num, num_warns, fin_file, fail_file = processor.doImport( 1162 csv_file, STUDYLEVEL_HEADER_FIELDS,'create') 1163 self.assertEqual(num_warns,3) 1164 assert processor.entryExists( 1165 dict(reg_number='1', level='100'), self.app) is True 1166 studylevel = processor.getEntry( 1167 dict(reg_number='1', level='100'), self.app) 1168 self.assertEqual(studylevel.__parent__.certificate.code, u'CERT1') 1169 self.assertEqual(studylevel.level_session, 2008) 1170 self.assertEqual(studylevel.level_verdict, '0') 1171 self.assertEqual(studylevel.level, 100) 1172 self.assertEqual([i for i in results[0]['studycourse_1'].keys()], 1173 [u'100', u'200']) 1174 processor = FirstCourseTicketProcessor() 1175 csv_file = os.path.join( 1176 self.workdir, 'sample_courseticket_data.csv') 1177 num, num_warns, fin_file, fail_file = processor.doImport( 1178 csv_file, COURSETICKET_HEADER_FIELDS,'create') 1179 assert processor.entryExists( 1180 dict(reg_number='1', level='100', code='COURSE1'), self.app) is True 1181 self.assertEqual([i for i in results[0]['studycourse_1']['100'].keys()], 1182 [u'COURSE1']) 1137 1183 shutil.rmtree(os.path.dirname(fin_file)) 1138 1184 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r16662 r16828 1650 1650 modeselect = self.browser.getControl(name='mode') 1651 1651 importerselect.getControl( 1652 'StudentStudyCourse Processor (update only)' ).selected = True1652 'StudentStudyCourse Processor (update only)',index=0).selected = True 1653 1653 modeselect.getControl(value='create').selected = True 1654 1654 self.browser.getControl('Proceed to step 3').click() -
main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
r16812 r16828 136 136 STUDY_MODES_DICT = { 137 137 'transfer': 'Transfer', 138 'transferred': 'Transferred', 138 139 'ug_ft': 'Undergraduate Full-Time', 139 140 'ug_pt': 'Undergraduate Part-Time',
Note: See TracChangeset for help on using the changeset viewer.