Changeset 9284 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 4 Oct 2012, 05:38:17 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r9282 r9284 35 35 from waeup.kofa.interfaces import ( 36 36 IBatchProcessor, FatalCSVError, IObjectConverter, IUserAccount, 37 IObjectHistory, VALIDATED, IGNORE_MARKER)37 IObjectHistory, VALIDATED, REGISTERED, IGNORE_MARKER) 38 38 from waeup.kofa.interfaces import MessageFactory as _ 39 39 from waeup.kofa.students.interfaces import ( … … 717 717 factory_name = 'waeup.StudentStudyCourse' 718 718 719 additional_fields = ['current_session', 'current_level'] 719 additional_fields = [ 720 'current_session', 721 'current_level', 722 'bypass_validation'] 720 723 721 724 def checkUpdateRequirements(self, obj, row, site): … … 729 732 if obj.current_session != row['current_session']: 730 733 return 'Current session does not correspond.' 731 # Check if student is in state REGISTERED732 if obj.student.state != VALIDATED:733 return 'Student in wrong state.'734 734 # Check if new verdict is provided 735 735 if row['current_verdict'] in (IGNORE_MARKER, ''): 736 736 return 'Verdict is missing.' 737 # Check if student is in state REGISTERED or VALIDATED 738 if row.get('bypass_validation') in ('1', 'True', 'TRUE', 'yes'): 739 if obj.student.state not in (VALIDATED, REGISTERED): 740 return 'Student in wrong state.' 741 else: 742 if obj.student.state != VALIDATED: 743 return 'Student in wrong state.' 737 744 return None 738 745 … … 749 756 '%s - Verdict updated: %s' 750 757 % (parent.student_id, items_changed)) 751 # Fire transition 752 IWorkflowInfo(obj.__parent__).fireTransition('return') 758 # Fire transition depending on student's state 759 if obj.__parent__.state == REGISTERED: 760 IWorkflowInfo(obj.__parent__).fireTransition('bypass_validation') 761 else: 762 IWorkflowInfo(obj.__parent__).fireTransition('return') 753 763 # Update the students_catalog 754 764 notify(grok.ObjectModifiedEvent(obj.__parent__)) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv
r9282 r9284 3 3 Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated 4 4 ,Susann,Berson,3,1990-01-04,100002,aa@aa.ng,1234,f,courses validated 5 ,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f, courses registered5 ,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,school fee paid 6 6 X888888,Alfons,Meier,5,1990-01-02,100004,aa@aa.ng,1234,m,courses validated 7 X999999,Herbert,Mueller,6,1990-01-02,100005,aa@aa.ng,1234,m,courses registered 8 X111111,Fabian,Riester,7,1990-01-02,100006,aa@aa.ng,1234,m,courses validated -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update3.csv
r8309 r9284 3 3 Y777777,,return 4 4 ,3,return 5 ,4, validate_courses5 ,4,register_courses -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_studycourse_data.csv
r9282 r9284 6 6 4,,CERT1,2008,200 7 7 5,,CERT1,2008,200 8 6,,CERT1,2008,200 9 7,,CERT1,2008,200 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_verdict_data.csv
r9282 r9284 1 matric_number,current_session,current_level,current_verdict 2 100000,2008,200,A 3 100001,2008,100,B 4 100002,2007,200,C 5 100003,2008,200,A 6 100004,2008,200, 1 matric_number,current_session,current_level,current_verdict,bypass_validation 2 100000,2008,200,A,0 3 100001,2008,100,B,False 4 100002,2007,200,C, 5 100003,2008,200,A, 6 100004,2008,200,, 7 100005,2008,200,A,1 8 100006,2008,200,A,True -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r9283 r9284 360 360 self.csv_file, STUDENT_HEADER_FIELDS) 361 361 self.assertEqual(num_warns,0) 362 assert len(self.app['students'].keys()) == 6362 self.assertEqual(len(self.app['students']), 8) 363 363 self.assertEqual(self.app['students']['X666666'].reg_number,'1') 364 364 self.assertEqual( … … 612 612 self.assertEqual(student.state, 'returning') 613 613 self.assertEqual(studycourse.current_level, 200) 614 student = self.processor.getParent( 615 dict(matric_number='100005'), self.app) 616 self.assertEqual(studycourse.current_verdict, 'A') 617 self.assertEqual(student.state, 'returning') 618 self.assertEqual(studycourse.current_level, 200) 614 619 content = open(fail_file).read() 615 620 self.assertEqual( 616 621 content, 617 'current_session,current_verdict,matric_number,current_level,--ERRORS--\r\n' 618 '2008,B,100001,100,Current level does not correspond.\r\n' 619 '2007,C,100002,200,Current session does not correspond.\r\n' 620 '2008,A,100003,200,Student in wrong state.\r\n' 621 '2008,<IGNORE>,100004,200,Verdict is missing.\r\n' 622 'current_session,current_verdict,bypass_validation,' 623 'matric_number,current_level,--ERRORS--\r\n' 624 '2008,B,False,100001,100,Current level does not correspond.\r\n' 625 '2007,C,<IGNORE>,100002,200,Current session does not correspond.\r\n' 626 '2008,A,<IGNORE>,100003,200,Student in wrong state.\r\n' 627 '2008,<IGNORE>,<IGNORE>,100004,200,Verdict is missing.\r\n' 622 628 ) 623 629 shutil.rmtree(os.path.dirname(fin_file)) -
main/waeup.kofa/trunk/src/waeup/kofa/students/workflow.py
r9161 r9284 164 164 165 165 Transition( 166 transition_id = 'bypass_validation', 167 title = _('Return and bypass validation'), 168 msg = _("Returned"), 169 source = REGISTERED, 170 destination = RETURNING), 171 172 Transition( 166 173 transition_id = 'reset8', 167 174 title = _('Reset to school fee paid'), … … 173 180 transition_id = 'return', 174 181 title = _('Return'), 175 msg = _("Re set to 'returning'"),182 msg = _("Returned"), 176 183 source = VALIDATED, 177 184 destination = RETURNING),
Note: See TracChangeset for help on using the changeset viewer.