Changeset 9006 for main/waeup.uniben/trunk/src/waeup/uniben/students
- Timestamp:
- 16 Jul 2012, 07:36:13 (12 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r8959 r9006 86 86 self.browser.contents) 87 87 IWorkflowState(self.student).setState('cleared') 88 self.student.nationality = u'NG' 88 89 self.browser.open(self.payments_path + '/addop') 89 90 self.browser.getControl("Create ticket").click() … … 190 191 return 191 192 193 def test_set_returning_data(self): 194 # Student is in level 100, session 2004 with verdict A 195 utils = getUtility(IStudentsUtils) 196 197 utils.setReturningData(self.student) 198 self.assertEqual(self.student['studycourse'].current_session, 2005) 199 self.assertEqual(self.student['studycourse'].current_level, 200) 200 201 self.student['studycourse'].current_session = 2004 202 self.student['studycourse'].current_level = 100 203 self.student['studycourse'].current_verdict = 'C' 204 utils.setReturningData(self.student) 205 self.assertEqual(self.student['studycourse'].current_session, 2005) 206 self.assertEqual(self.student['studycourse'].current_level, 110) 207 208 self.student['studycourse'].current_session = 2004 209 self.student['studycourse'].current_level = 100 210 self.student['studycourse'].current_verdict = 'D' 211 utils.setReturningData(self.student) 212 self.assertEqual(self.student['studycourse'].current_session, 2005) 213 self.assertEqual(self.student['studycourse'].current_level, 100) 214 return 215 192 216 def test_set_payment_details(self): 193 217 self.app['configuration']['2004'].gown_fee = 150.0 … … 206 230 207 231 IWorkflowState(self.student).setState('cleared') 232 self.student.nationality = u'NG' 208 233 error, payment = utils.setPaymentDetails('schoolfee',self.student) 209 234 self.assertEqual(payment.p_level, 100) … … 229 254 self.assertEqual(error, None) 230 255 256 self.student.is_staff = True 257 error, payment = utils.setPaymentDetails('schoolfee',self.student) 258 self.assertEqual(payment.p_level, 200) 259 self.assertEqual(payment.p_session, 2005) 260 self.assertEqual(payment.amount_auth, 10088.0) 261 self.assertEqual(payment.p_item, u'CERT1') 262 self.assertEqual(error, None) 263 264 IWorkflowState(self.student).setState('cleared') 265 self.student.is_staff = False 266 self.student.nationality = u'DE' 267 self.certificate.school_fee_3 = 60000.0 268 error, payment = utils.setPaymentDetails('schoolfee',self.student) 269 self.assertEqual(payment.p_level, 100) 270 self.assertEqual(payment.p_session, 2004) 271 self.assertEqual(payment.amount_auth, 60099.0) 272 self.assertEqual(payment.p_item, u'CERT1') 273 self.assertEqual(error, None) 274 275 IWorkflowState(self.student).setState('returning') 276 self.student.is_staff = False 277 self.student.nationality = u'DE' 278 self.certificate.school_fee_4 = 20000.0 279 error, payment = utils.setPaymentDetails('schoolfee',self.student) 280 self.assertEqual(payment.p_level, 200) 281 self.assertEqual(payment.p_session, 2005) 282 self.assertEqual(payment.amount_auth, 20088.0) 283 self.assertEqual(payment.p_item, u'CERT1') 284 self.assertEqual(error, None) 285 231 286 error, payment = utils.setPaymentDetails('clearance',self.student) 232 287 self.assertEqual(payment.p_level, 100) -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r8959 r9006 90 90 return _('Study course data are incomplete.'), None 91 91 if student.state == CLEARED: 92 amount = getattr(certificate, 'school_fee_1', 0.0) 92 if student.is_foreigner: 93 amount = getattr(certificate, 'school_fee_3', 0.0) 94 else: 95 amount = getattr(certificate, 'school_fee_1', 0.0) 93 96 elif student.state == RETURNING: 94 97 # In case of returning school fee payment the payment session … … 96 99 # has paid for. 97 100 p_session, p_level = self.getReturningData(student) 98 amount = getattr(certificate, 'school_fee_2', 0.0) 101 if student.is_foreigner: 102 amount = getattr(certificate, 'school_fee_4', 0.0) 103 else: 104 amount = getattr(certificate, 'school_fee_2', 0.0) 99 105 try: 100 106 academic_session = grok.getSite()[ … … 106 112 # but their level always remains the same. 107 113 p_session += 1 108 amount = getattr(certificate, 'school_fee_2', 0.0) 114 if student.is_foreigner: 115 amount = getattr(certificate, 'school_fee_4', 0.0) 116 else: 117 amount = getattr(certificate, 'school_fee_2', 0.0) 109 118 try: 110 119 academic_session = grok.getSite()[ … … 112 121 except KeyError: 113 122 return _(u'Session configuration object is not available.'), None 123 # Give 50% school fee discount to staff members. 124 if student.is_staff: 125 amount /= 2 114 126 if amount in (0.0, None): 115 127 return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.