Changeset 9251 for main/waeup.uniben/trunk/src/waeup/uniben/students
- Timestamp:
- 28 Sep 2012, 06:22:59 (12 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r9222 r9251 27 27 StudentClearPage, StudentRejectClearancePage, 28 28 StudyCourseDisplayFormPage, msave, emit_lock_message) 29 from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS 29 30 from kofacustom.nigeria.students.browser import ( 30 31 NigeriaOnlinePaymentDisplayFormPage, 32 NigeriaStudentBaseManageFormPage, 31 33 NigeriaOnlinePaymentAddFormPage, 32 34 NigeriaExportPDFPaymentSlipPage) 35 #from waeup.uniben.students.interfaces import ICustomStudent 33 36 34 37 from waeup.uniben.students.interfaces import ( 35 38 ICustomStudentOnlinePayment, ICustomStudentStudyCourse) 36 39 from waeup.uniben.interfaces import MessageFactory as _ 40 41 class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): 42 """ View to manage student base data 43 """ 44 #grok.context(ICustomStudent) 45 46 def getTransitions(self): 47 """Return a list of dicts of allowed transition ids and titles. 48 49 Each list entry provides keys ``name`` and ``title`` for 50 internal name and (human readable) title of a single 51 transition. 52 """ 53 allowed_transitions = [t for t in self.wf_info.getManualTransitions() 54 if not t[0].startswith('pay')] 55 if self.context.is_postgrad and not self.context.is_special_postgrad: 56 allowed_transitions = [t for t in allowed_transitions 57 if not t[0] in FORBIDDEN_POSTGRAD_TRANS] 58 return [dict(name='', title=_('No transition'))] +[ 59 dict(name=x, title=y) for x, y in allowed_transitions] 37 60 38 61 class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): -
main/waeup.uniben/trunk/src/waeup/uniben/students/student.py
r8988 r9251 35 35 grok.provides(ICustomStudent) 36 36 37 @property 38 def is_special_postgrad(self): 39 is_special_postgrad = getattr( 40 self.get('studycourse', None), 'is_special_postgrad', False) 41 return is_special_postgrad 42 37 43 38 44 # Set all attributes of Student required in IStudent as field -
main/waeup.uniben/trunk/src/waeup/uniben/students/studycourse.py
r8865 r9251 37 37 38 38 @property 39 def is_postgrad(self): 40 if self.certificate is None: 41 return False 42 return self.certificate.study_mode.startswith('pg') or \ 43 self.certificate.study_mode.startswith('special_pg') 44 45 @property 46 def is_special_postgrad(self): 47 if self.certificate is None: 48 return False 49 return self.certificate.study_mode.startswith('special_pg') 50 51 @property 39 52 def next_session_allowed(self): 40 53 state = self.student.state … … 56 69 cond5 = self.is_postgrad 57 70 cond6 = state == PAID 58 if cond5 and cond6: 71 cond7 = self.is_special_postgrad 72 if cond5 and cond6 and not cond7: 59 73 return True 60 74 return False -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r9210 r9251 73 73 layer = FunctionalLayer 74 74 75 def test_next_session_allowed(self): 76 # Let's see if next_session_allowed works as expected 77 # A, ug_ft, 100 78 IWorkflowState(self.student).setState('returning') 79 self.assertTrue(self.student['studycourse'].next_session_allowed) 80 # Uniben special PG programmes have the same workflow 81 # as UG students 82 self.certificate.study_mode = 'special_pg_pt' 83 self.assertTrue(self.student['studycourse'].next_session_allowed) 84 IWorkflowState(self.student).setState('school fee paid') 85 self.assertFalse(self.student['studycourse'].next_session_allowed) 86 # Now we convert the certificate into a 'regular 87 # postgraduate certificate ... 88 self.certificate.study_mode = 'pg_ft' 89 # ... and voila next session registration is allowed 90 self.assertTrue(self.student['studycourse'].next_session_allowed) 91 92 def test_manage_access(self): 93 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 94 # The student created in the base package is a ug student 95 self.browser.open(self.manage_clearance_path) 96 self.assertMatches('...First Sitting Record...', 97 self.browser.contents) 98 # There is no pg field in the clearance form 99 self.assertFalse('Second Higher Education Record' 100 in self.browser.contents) 101 # Now we change the study mode ... 102 self.certificate.study_mode = 'pg_ft' 103 self.browser.open(self.clearance_path) 104 # ... and additional pg clearance fields appear 105 self.assertMatches('...Second Higher Education Record...', 106 self.browser.contents) 107 # But also fields from the ug form are displayed 108 self.assertMatches('...First Sitting Record...', 109 self.browser.contents) 110 # The same holds for Uniben's special pg students 111 self.certificate.study_mode = 'special_pg_ft' 112 self.browser.open(self.clearance_path) 113 self.assertMatches('...Second Higher Education Record...', 114 self.browser.contents) 115 self.assertMatches('...First Sitting Record...', 116 self.browser.contents) 117 75 118 def test_manage_payments(self): 76 119 # Add missing configuration data … … 301 344 self.assertEqual(payment.p_item, u'CERT1') 302 345 self.assertEqual(error, None) 303 304 346 self.student.is_staff = True 305 347 error, payment = utils.setPaymentDetails('schoolfee', … … 332 374 self.assertEqual(payment.p_session, 2005) 333 375 self.assertEqual(payment.amount_auth, 20088.0) 376 self.assertEqual(payment.p_item, u'CERT1') 377 self.assertEqual(error, None) 378 379 # In Uniben we have pg and special pg students. 380 # They pay the same but their workflow is different. 381 IWorkflowState(self.student).setState('school fee paid') 382 self.student.is_staff = False 383 self.student.nationality = u'NG' 384 self.certificate.school_fee_2 = 10000.0 385 error, payment = utils.setPaymentDetails( 386 'schoolfee', self.student, None, None) 387 self.assertEqual(payment, None) 388 self.assertTrue('not be determined' in error) 389 self.certificate.study_mode = 'pg_pt' 390 self.assertTrue(self.student.is_postgrad) 391 self.assertFalse(self.student.is_special_postgrad) 392 error, payment = utils.setPaymentDetails( 393 'schoolfee', self.student, None, None) 394 self.assertEqual(payment.p_level, 100) 395 self.assertEqual(payment.p_session, 2005) 396 self.assertEqual(payment.amount_auth, 10000.0) 397 self.assertEqual(payment.p_item, u'CERT1') 398 self.assertEqual(error, None) 399 self.certificate.study_mode = 'special_pg_pt' 400 self.assertTrue(self.student.is_postgrad) 401 self.assertTrue(self.student.is_special_postgrad) 402 error, payment = utils.setPaymentDetails( 403 'schoolfee', self.student, None, None) 404 self.assertTrue('not be determined' in error) 405 IWorkflowState(self.student).setState('returning') 406 error, payment = utils.setPaymentDetails( 407 'schoolfee', self.student, None, None) 408 self.assertEqual(payment.p_level, 200) 409 self.assertEqual(payment.p_session, 2005) 410 self.assertEqual(payment.amount_auth, 10000.0) 334 411 self.assertEqual(payment.p_item, u'CERT1') 335 412 self.assertEqual(error, None) -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r9206 r9251 132 132 except KeyError: 133 133 return _(u'Session configuration object is not available.'), None 134 elif student.is_postgrad and student.state == PAID: 135 # Returning postgraduate students also pay for the next session 136 # but their level always remains the same. 134 elif student.state == PAID and student.is_postgrad and \ 135 not student.is_special_postgrad: 136 # Regular returning postgraduate students also pay 137 # for the next session but their level always remains the same. 137 138 p_session += 1 138 139 if student.is_foreigner:
Note: See TracChangeset for help on using the changeset viewer.