Changeset 16000 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 11 Feb 2020, 12:15:26 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r15628 r16000 637 637 Like all other student data importers, this processor also requires 638 638 either `student_id`, `reg_number` or `matric_number` to find the student. 639 Then 639 Then it needs `level` and `code` to localize the course ticket. 640 640 641 641 `checkConversion` first searches the courses catalog for the imported … … 650 650 nor by import. Other values can be overwritten by import. 651 651 652 `ticket_session` is an additional attribute which can be used to store the652 `ticket_session` is an additional field which can be used to store the 653 653 session of the course when it was taken. Usually this information is 654 654 redundant because the parent study level object already contains this 655 655 information, except for the study level zero container which can be used to 656 656 store 'orphaned' course tickets. 657 658 `checkUpdateRequirements` ensures that the `score` attribute can't 659 be accidentally overwritten by import in update mode. The `score` 660 attribute can be unlocked by setting the boolean field 661 `unlock_score` = 1. 657 662 """ 658 663 grok.implements(IBatchProcessor) … … 675 680 'mandatory', 'score', 'carry_over', 'automatic', 676 681 'outstanding', 'course_category', 'level_session', 677 'title', 'credits', 'passmark', 'semester', 'ticket_session' 682 'title', 'credits', 'passmark', 'semester', 'ticket_session', 683 'unlock_score' 678 684 ] + self.additional_fields 679 685 return sorted(fields) … … 735 741 if obj.student.studycourse_locked: 736 742 return 'Studycourse is locked.' 743 if row.get('score',None) and obj.score and not row.get( 744 'unlock_score',None): 745 return 'Score attribute is locked.' 737 746 return None 738 747 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_courseticket_data.csv
r15203 r16000 1 reg_number,matric_number,level,code,score,mandatory,level_session,ticket_session 2 1,,100,COURSE1,1,True,, 3 2,,100,COURSE1,2,False,, 4 ,100002,100,COURSE1,3,False,, 5 1,,200,COURSE1,1,True,2008, 6 1,,nonsense,COURSE1,5,,, 7 1,,100,NONSENSE,5,,, 8 1,,200,COURSE1,6,,2004, 9 1,,300,COURSE1,6,,2008, 10 1,,300,COURSE1,6,,2008X, 1 reg_number,matric_number,level,code,score,mandatory,level_session,ticket_session,unlock_score 2 1,,100,COURSE1,1,True,,, 3 2,,100,COURSE1,2,False,,, 4 ,100002,100,COURSE1,3,False,,, 5 1,,200,COURSE1,1,True,2008,, 6 1,,nonsense,COURSE1,5,,,, 7 1,,100,NONSENSE,5,,,, 8 1,,200,COURSE1,6,,2004,, 9 1,,300,COURSE1,6,,2008,, 10 1,,300,COURSE1,6,,2008X,, -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r15628 r16000 962 962 self.assertEqual(num_warns,5) 963 963 self.assertEqual(fail_file, 964 'reg_number,code,mandatory,level,level_session,ticket_session,score, matric_number,--ERRORS--\r\n'965 '1,COURSE1,<IGNORE>,nonsense,<IGNORE>,<IGNORE>,5,<IGNORE>, Not all parents do exist yet.\r\n'966 '1,NONSENSE,<IGNORE>,100,<IGNORE>,<IGNORE>,5,<IGNORE>, code: non-existent\r\n'967 '1,COURSE1,<IGNORE>,200,2004,<IGNORE>,6,<IGNORE>, level_session: does not match 2008\r\n'968 '1,COURSE1,<IGNORE>,300,2008,<IGNORE>,6,<IGNORE>, level object: does not exist\r\n'969 '1,COURSE1,<IGNORE>,300,2008X,<IGNORE>,6,<IGNORE>, level_session: Invalid value\r\n')964 'reg_number,code,mandatory,level,level_session,ticket_session,score,unlock_score,matric_number,--ERRORS--\r\n' 965 '1,COURSE1,<IGNORE>,nonsense,<IGNORE>,<IGNORE>,5,<IGNORE>,<IGNORE>,Not all parents do exist yet.\r\n' 966 '1,NONSENSE,<IGNORE>,100,<IGNORE>,<IGNORE>,5,<IGNORE>,<IGNORE>,code: non-existent\r\n' 967 '1,COURSE1,<IGNORE>,200,2004,<IGNORE>,6,<IGNORE>,<IGNORE>,level_session: does not match 2008\r\n' 968 '1,COURSE1,<IGNORE>,300,2008,<IGNORE>,6,<IGNORE>,<IGNORE>,level object: does not exist\r\n' 969 '1,COURSE1,<IGNORE>,300,2008X,<IGNORE>,6,<IGNORE>,<IGNORE>,level_session: Invalid value\r\n') 970 970 assert self.processor.entryExists( 971 971 dict(reg_number='1', level='100', code='COURSE1'), … … 1015 1015 self.assertEqual(num_warns,5) 1016 1016 self.assertEqual(fail_file, 1017 'reg_number,code,mandatory,level,level_session,ticket_session,score, matric_number,--ERRORS--\r\n'1018 '1,COURSE1,<IGNORE>,nonsense,<IGNORE>,<IGNORE>,5,<IGNORE>, Cannot update: no such entry\r\n'1019 '1,NONSENSE,<IGNORE>,100,<IGNORE>,<IGNORE>,5,<IGNORE>, code: non-existent\r\n'1020 '1,COURSE1,<IGNORE>,200,2004,<IGNORE>,6,<IGNORE>, level_session: does not match 2008\r\n'1021 '1,COURSE1,<IGNORE>,300,2008,<IGNORE>,6,<IGNORE>, level object: does not exist\r\n'1022 '1,COURSE1,<IGNORE>,300,2008X,<IGNORE>,6,<IGNORE>, level_session: Invalid value\r\n')1017 'reg_number,code,mandatory,level,level_session,ticket_session,score,unlock_score,matric_number,--ERRORS--\r\n' 1018 '1,COURSE1,<IGNORE>,nonsense,<IGNORE>,<IGNORE>,5,<IGNORE>,<IGNORE>,Cannot update: no such entry\r\n' 1019 '1,NONSENSE,<IGNORE>,100,<IGNORE>,<IGNORE>,5,<IGNORE>,<IGNORE>,code: non-existent\r\n' 1020 '1,COURSE1,<IGNORE>,200,2004,<IGNORE>,6,<IGNORE>,<IGNORE>,level_session: does not match 2008\r\n' 1021 '1,COURSE1,<IGNORE>,300,2008,<IGNORE>,6,<IGNORE>,<IGNORE>,level object: does not exist\r\n' 1022 '1,COURSE1,<IGNORE>,300,2008X,<IGNORE>,6,<IGNORE>,<IGNORE>,level_session: Invalid value\r\n') 1023 1023 shutil.rmtree(os.path.dirname(fin_file)) 1024 1024 … … 1057 1057 self.assertEqual(num_warns,7) 1058 1058 self.assertEqual(fail_file, 1059 'reg_number,code,mandatory,level,level_session,ticket_session,score, matric_number,--ERRORS--\r\n'1060 '1,COURSE1,True,100,<IGNORE>,<IGNORE>,1,<IGNORE>, Studycourse is locked.\r\n'1061 '1,COURSE1,True,200,2008,<IGNORE>,1,<IGNORE>, Studycourse is locked.\r\n'1062 '1,COURSE1,<IGNORE>,nonsense,<IGNORE>,<IGNORE>,5,<IGNORE>, Cannot update: no such entry\r\n'1063 '1,NONSENSE,<IGNORE>,100,<IGNORE>,<IGNORE>,5,<IGNORE>, code: non-existent\r\n'1064 '1,COURSE1,<IGNORE>,200,2004,<IGNORE>,6,<IGNORE>, level_session: does not match 2008\r\n'1065 '1,COURSE1,<IGNORE>,300,2008,<IGNORE>,6,<IGNORE>, level object: does not exist\r\n'1066 '1,COURSE1,<IGNORE>,300,2008X,<IGNORE>,6,<IGNORE>, level_session: Invalid value\r\n')1059 'reg_number,code,mandatory,level,level_session,ticket_session,score,unlock_score,matric_number,--ERRORS--\r\n' 1060 '1,COURSE1,True,100,<IGNORE>,<IGNORE>,1,<IGNORE>,<IGNORE>,Studycourse is locked.\r\n' 1061 '1,COURSE1,True,200,2008,<IGNORE>,1,<IGNORE>,<IGNORE>,Studycourse is locked.\r\n' 1062 '1,COURSE1,<IGNORE>,nonsense,<IGNORE>,<IGNORE>,5,<IGNORE>,<IGNORE>,Cannot update: no such entry\r\n' 1063 '1,NONSENSE,<IGNORE>,100,<IGNORE>,<IGNORE>,5,<IGNORE>,<IGNORE>,code: non-existent\r\n' 1064 '1,COURSE1,<IGNORE>,200,2004,<IGNORE>,6,<IGNORE>,<IGNORE>,level_session: does not match 2008\r\n' 1065 '1,COURSE1,<IGNORE>,300,2008,<IGNORE>,6,<IGNORE>,<IGNORE>,level object: does not exist\r\n' 1066 '1,COURSE1,<IGNORE>,300,2008X,<IGNORE>,6,<IGNORE>,<IGNORE>,level_session: Invalid value\r\n') 1067 1067 shutil.rmtree(os.path.dirname(fin_file)) 1068 1068
Note: See TracChangeset for help on using the changeset viewer.