Changeset 9161 for main/waeup.kofa/trunk/src
- Timestamp:
- 6 Sep 2012, 07:43:51 (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
r9160 r9161 470 470 location_fields = [] 471 471 472 # Validation fields can be removed after data migration from SRP. 473 additional_fields = ['level', 474 'validated_by', 'validation_date'] 472 additional_fields = ['level'] 475 473 additional_headers = ['level'] 476 474 -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9148 r9161 850 850 grok.require('waeup.viewStudent') 851 851 form_fields = grok.AutoFields(IStudentStudyLevel) 852 form_fields[ 853 'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 852 854 grok.template('studylevelpage') 853 855 pnav = 4 … … 945 947 grok.require('waeup.manageStudent') 946 948 grok.template('studylevelmanagepage') 947 form_fields = grok.AutoFields(IStudentStudyLevel) 949 form_fields = grok.AutoFields(IStudentStudyLevel).omit( 950 'validation_date', 'validated_by') 948 951 pnav = 4 949 952 taboneactions = [_('Save'),_('Cancel')] -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r9150 r9161 426 426 """ 427 427 level = Attribute('The level code') 428 validation_date = Attribute('The date of validation')429 validated_by = Attribute('User Id of course adviser')430 428 431 429 level_session = schema.Choice( … … 440 438 default = '0', 441 439 required = False, 440 ) 441 442 validated_by = schema.TextLine( 443 title = _(u'Validated by'), 444 default = None, 445 required = False, 446 ) 447 448 validation_date = schema.Datetime( 449 title = _(u'Validation Date'), 450 required = False, 451 readonly = False, 442 452 ) 443 453 -
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r8920 r9161 37 37 super(StudentStudyLevel, self).__init__() 38 38 self.level = None 39 self.validation_date = None40 self.validated_by = None41 39 return 42 40 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9148 r9161 967 967 self.app['users'].addUser('mrsadvise', 'mrsadvisesecret') 968 968 self.app['users']['mrsadvise'].email = 'mradvise@foo.ng' 969 self.app['users']['mrsadvise'].title = 'Helen Procter'969 self.app['users']['mrsadvise'].title = u'Helen Procter' 970 970 # Assign local CourseAdviser100 role for a certificate 971 971 cert = self.app['faculties']['fac1']['dep1'].certificates['CERT1'] … … 1018 1018 # the 100L CA does see the 'Validate' button 1019 1019 self.browser.open(L110_student_path) 1020 self.assertFalse('Validate ' in self.browser.contents)1020 self.assertFalse('Validate courses' in self.browser.contents) 1021 1021 IWorkflowInfo(self.student).fireTransition('register_courses') 1022 1022 self.browser.open(L110_student_path) 1023 self.assertFalse('Validate ' in self.browser.contents)1023 self.assertFalse('Validate courses' in self.browser.contents) 1024 1024 self.student['studycourse'].current_level = 110 1025 1025 self.browser.open(L110_student_path) 1026 self.assertTrue('Validate ' in self.browser.contents)1026 self.assertTrue('Validate courses' in self.browser.contents) 1027 1027 # ... but a 100L CA does not see the button on other levels 1028 1028 studylevel2 = StudentStudyLevel() … … 1032 1032 L200_student_path = self.studycourse_path + '/200' 1033 1033 self.browser.open(L200_student_path) 1034 self.assertFalse('Validate ' in self.browser.contents)1034 self.assertFalse('Validate courses' in self.browser.contents) 1035 1035 self.browser.open(L110_student_path) 1036 1036 self.browser.getLink("Validate courses").click() 1037 1037 self.assertTrue('Course list has been validated' in self.browser.contents) 1038 1038 self.assertTrue('courses validated' in self.browser.contents) 1039 self.assertEqual(self.student['studycourse']['110'].validated_by, 1040 'Helen Procter') 1041 self.assertMatches( 1042 '<YYYY-MM-DD hh:mm:ss>', 1043 self.student['studycourse']['110'].validation_date.strftime( 1044 "%Y-%m-%d %H:%M:%S")) 1039 1045 self.browser.getLink("Reject courses").click() 1040 1046 self.assertTrue('Course list request has been annulled.' … … 1044 1050 '/contactstudent?subject=%s' % urlmessage) 1045 1051 self.assertTrue('school fee paid' in self.browser.contents) 1052 self.assertTrue(self.student['studycourse']['110'].validated_by is None) 1053 self.assertTrue(self.student['studycourse']['110'].validation_date is None) 1046 1054 IWorkflowInfo(self.student).fireTransition('register_courses') 1047 1055 self.browser.open(L110_student_path) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r9148 r9161 209 209 self.assertEqual( 210 210 result, 211 'level,level_session,level_verdict,student_id\r\n' 212 ',,0,\r\n' 211 'level,level_session,level_verdict,validated_by,validation_date,' 212 'student_id\r\n' 213 ',,0,,,\r\n' 213 214 ) 214 215 return … … 225 226 self.assertEqual( 226 227 result, 227 'level,level_session,level_verdict,student_id\r\n' 228 '100,2012,A,A111111\r\n' 228 'level,level_session,level_verdict,validated_by,validation_date,' 229 'student_id\r\n' 230 '100,2012,A,,,A111111\r\n' 229 231 ) 230 232 return … … 239 241 self.assertEqual( 240 242 result, 241 'level,level_session,level_verdict,student_id\r\n' 242 '100,2012,A,A111111\r\n' 243 'level,level_session,level_verdict,validated_by,validation_date,' 244 'student_id\r\n' 245 '100,2012,A,,,A111111\r\n' 243 246 ) 244 247 return … … 252 255 self.assertEqual( 253 256 result, 254 'level,level_session,level_verdict,student_id\r\n' 255 '100,2012,A,A111111\r\n' 257 'level,level_session,level_verdict,validated_by,validation_date,' 258 'student_id\r\n' 259 '100,2012,A,,,A111111\r\n' 256 260 ) 257 261 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/workflow.py
r9028 r9161 2 2 """ 3 3 import grok 4 from datetime import datetime 4 5 from zope.component import getUtility 5 6 from hurry.workflow.workflow import Transition, WorkflowState, NullCondition … … 12 13 from waeup.kofa.workflow import KofaWorkflow, KofaWorkflowInfo 13 14 from waeup.kofa.students.interfaces import IStudent, IStudentsUtils 15 from waeup.kofa.utils.helpers import get_current_principal 14 16 15 17 … … 234 236 new_session = obj['studycourse'].current_session + 1 235 237 obj['studycourse'].current_session = new_session 238 elif event.transition.transition_id == 'validate_courses': 239 current_level = obj['studycourse'].current_level 240 level_object = obj['studycourse'].get(str(current_level), None) 241 if level_object is not None: 242 user = get_current_principal() 243 if user is None: 244 usertitle = 'system' 245 else: 246 usertitle = getattr(user, 'public_name', None) 247 if not usertitle: 248 usertitle = user.title 249 level_object.validated_by = usertitle 250 level_object.validation_date = datetime.utcnow() 251 elif event.transition.transition_id == 'reset8': 252 current_level = obj['studycourse'].current_level 253 level_object = obj['studycourse'].get(str(current_level), None) 254 if level_object is not None: 255 level_object.validated_by = None 256 level_object.validation_date = None 236 257 # In some tests we don't have a students container 237 258 try:
Note: See TracChangeset for help on using the changeset viewer.