Changeset 9393 for main/waeup.kwarapoly/trunk/src/waeup
- Timestamp:
- 23 Oct 2012, 08:32:05 (12 years ago)
- Location:
- main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/tests/test_browser.py
r9388 r9393 32 32 from waeup.kofa.students.interfaces import IStudentsUtils 33 33 from waeup.kwarapoly.testing import FunctionalLayer 34 from waeup.kwarapoly.students.utils import ( 35 local_nonlocal, arts_science, pt_ft) 34 36 35 37 … … 195 197 196 198 IWorkflowState(self.student).setState('cleared') 199 self.assertEqual(local_nonlocal(self.student), 'non-local') 200 self.assertEqual(arts_science(self.student), 'science') 201 self.assertEqual(pt_ft(self.student), 'ft') 202 197 203 error, payment = utils.setPaymentDetails('schoolfee',self.student) 198 204 self.assertEqual(payment.p_level, 100) 199 205 self.assertEqual(payment.p_session, 2004) 200 self.assertEqual(payment.amount_auth, 60980.0)206 self.assertEqual(payment.amount_auth, 44630.0) 201 207 self.assertEqual(payment.p_item, u'CERT1') 202 208 self.assertEqual(error, None) … … 206 212 self.assertEqual(payment.p_level, 200) 207 213 self.assertEqual(payment.p_session, 2005) 208 self.assertEqual(payment.amount_auth, 60980.0)214 self.assertEqual(payment.amount_auth, 44590.0) 209 215 self.assertEqual(payment.p_item, u'CERT1') 210 216 self.assertEqual(error, None) -
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/utils.py
r9388 r9393 24 24 from waeup.kofa.accesscodes import create_accesscode 25 25 from waeup.kofa.interfaces import CLEARED, RETURNING 26 from waeup.kofa.fees import FeeTable 26 27 from waeup.kwarapoly.interfaces import MessageFactory as _ 28 29 PAYMENT_LEVELS = (10, 100, 200, 210, 300, 400, 500, 510, 600, 999) 30 31 FEES_PARAMS = ( 32 ('ft', 'pt'), 33 ('local', 'non-local'), 34 ('science','arts'), 35 PAYMENT_LEVELS 36 ) 37 38 FEES_VALUES = ( 39 ( 40 ( 41 (34400.00, 37100.00, 43000.00, 29300.00, 0.00, 37900.00, 29700.00, 29900.00, 0.00, 47550.00), # science 42 (32900.00, 35600.00, 28000.00, 27800.00, 0.00, 36400.00, 28200.00, 28400.00, 0.00, 47550.00) # arts 43 ), # local 44 ( 45 (41930.00, 44630.00, 44590.00, 36400.00, 0.00, 46330.00, 32900.00, 38100.00, 0.00, 60980.00), # science 46 (40430.00, 43130.00, 29590.00, 34900.00, 0.00, 44830.00, 31400.00, 36600.00, 0.00, 60980.00) # arts 47 ), # non-local 48 ), # ft 49 ( 50 ( 51 (0.00, 38400.00, 30900.00, 0.00, 30900.00, 39000.00, 31550.00, 0.00, 31550.00, 0.00), # science 52 (0.00, 36900.00, 29400.00, 0.00, 29400.00, 37500.00, 30050.00, 0.00, 30050.00, 0.00) # arts 53 ), # local 54 ( 55 (0.00, 45600.00, 32350.00, 0.00, 32350.00, 47200.00, 35750.00, 0.00, 35750.00, 0.00), # science 56 (0.00, 44100.00, 30850.00, 0.00, 30850.00, 45700.00, 34250.00, 0.00, 34250.00, 0.00) # arts 57 ), # non-local 58 ), # pt 59 ) 60 61 SCHOOL_FEES = FeeTable(FEES_PARAMS, FEES_VALUES) 62 63 def local_nonlocal(student): 64 lga = getattr(student, 'lga') 65 if lga and student.lga.startswith('kwara'): 66 return 'local' 67 else: 68 return 'non-local' 69 70 def arts_science(student): 71 if student.faccode == 'IFMS': 72 return 'arts' 73 else: 74 return 'science' 75 76 def pt_ft(student): 77 if student.current_mode.endswith('pt'): 78 return 'pt' 79 else: 80 return 'ft' 27 81 28 82 class CustomStudentsUtils(NigeriaStudentsUtils): … … 30 84 31 85 """ 86 32 87 33 88 def selectBed(self, available_beds): … … 96 151 except (AttributeError, TypeError): 97 152 return _('Study course data are incomplete.'), None 98 99 100 153 if student.state == RETURNING: 101 154 p_session, p_level = self.getReturningData(student) 102 103 104 155 if student.state in (RETURNING, CLEARED): 105 amount = 60980.00 106 156 if p_level in PAYMENT_LEVELS: 157 amount = SCHOOL_FEES.get_fee( 158 (pt_ft(student), 159 local_nonlocal(student), 160 arts_science(student), 161 p_level) 162 ) 107 163 if amount in (0.0, None): 108 164 return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.