- Timestamp:
- 20 May 2012, 11:21:13 (13 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/studycourse.py
r8444 r8474 21 21 """ 22 22 import grok 23 from zope.interface import implementedBy 23 24 from waeup.kofa.students.studycourse import ( 24 25 StudentStudyCourse, StudentStudyCourseFactory) 26 from waeup.kofa.utils.helpers import attrs_to_fields 27 from waeup.kofa.students.workflow import CLEARED, RETURNING, PAID 25 28 from waeup.aaue.students.interfaces import ( 26 29 ICustomStudentStudyCourse, IStudentNavigation) 27 from zope.interface import implementedBy28 from waeup.kofa.utils.helpers import attrs_to_fields29 30 30 31 class CustomStudentStudyCourse(StudentStudyCourse): … … 36 37 37 38 @property 38 def may_register(self): 39 if self.previous_verdict in ( 40 'A','B','C','F','J','L','M','N','O','X','Z') or \ 41 self.current_level in (0, 100) or\ 42 (self.__parent__.current_mode.startswith('de') and self.current_level == 200) or \ 43 (self.__parent__.current_mode.startswith('ph') and self.current_level == 300): 39 def next_session_allowed(self): 40 state = self.getStudent().state 41 if state == CLEARED: 42 return True 43 cond0 = state == RETURNING 44 cond1 = self.previous_verdict in ( 45 'A','B','C','F','J','L','M','N','O','X','Z') 46 cond2 = self.current_level in (0, 100) 47 cond3 = self.getStudent().current_mode.startswith('de') and \ 48 self.current_level == 200 49 cond4 = self.getStudent().current_mode.startswith('ph') and \ 50 self.current_level == 300 51 if cond0 and (cond1 or cond2 or cond3 or cond4): 52 return True 53 cond5 = self.is_postgrad 54 cond6 = self.getStudent().state == PAID 55 if cond5 and cond6: 44 56 return True 45 57 return False -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r8444 r8474 113 113 ticket = createObject(u'waeup.CourseTicket') 114 114 verify.verifyObject(ICustomCourseTicket, ticket) 115 # Let's see if may_register works as expected 115 IWorkflowState(self.student).setState('returning') 116 # Let's see if next_session_allowed works as expected 116 117 # A, ug_ft, 100 117 self.assertTrue(self.student['studycourse']. may_register)118 self.assertTrue(self.student['studycourse'].next_session_allowed) 118 119 # O, ug_ft, 100 119 120 self.student['studycourse'].current_verdict = 'O' 120 self.assertTrue(self.student['studycourse']. may_register)121 self.assertTrue(self.student['studycourse'].next_session_allowed) 121 122 # O, ug_ft, 200 122 123 self.student['studycourse'].current_level = 200 123 self.assertFalse(self.student['studycourse']. may_register)124 self.assertFalse(self.student['studycourse'].next_session_allowed) 124 125 # O, de_ft, 200 125 126 self.student['studycourse'].certificate.study_mode = 'de_ft' 126 self.assertTrue(self.student['studycourse']. may_register)127 self.assertTrue(self.student['studycourse'].next_session_allowed) 127 128 # O, ph_ft, 300 128 129 self.student['studycourse'].certificate.study_mode = 'ph_ft' 129 130 self.student['studycourse'].current_level = 300 130 self.assertTrue(self.student['studycourse']. may_register)131 self.assertTrue(self.student['studycourse'].next_session_allowed) 131 132 # O, ph_ft, 400 132 133 self.student['studycourse'].current_level = 400 133 self.assertFalse(self.student['studycourse'].may_register) 134 self.assertFalse(self.student['studycourse'].next_session_allowed) 135 136 # Now we convert the certificate into a postgraduate certificate 137 IWorkflowState(self.student).setState('school fee paid') 138 self.certificate.study_mode = 'pg_ft' 139 # ... and voila next session registration is allowed 140 self.assertTrue(self.student['studycourse'].next_session_allowed) 134 141 135 142 def test_manage_access(self): -
main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py
r8444 r8474 17 17 ## 18 18 import grok 19 from waeup.kofa.interfaces import CLEARED, RETURNING 19 from waeup.kofa.interfaces import CLEARED, RETURNING, PAID 20 20 from waeup.kofa.students.utils import StudentsUtils 21 21 from waeup.kofa.students.interfaces import IStudentsUtils … … 96 96 # has paid for. 97 97 details['p_session'], details['p_level'] = self.getReturningData(student) 98 elif student.current_mode.startswith('pg') and student.state == PAID: 99 # Returning postgraduate students also pay for the next session 100 # but their level always remains the same. 101 details['p_session'] += 1 102 details['amount'] = getattr( 103 student['studycourse'].certificate,'school_fee_2') 98 104 if details['amount'] in (0.0, None): 99 105 details['error'] = _(u'Amount could not be determined.')
Note: See TracChangeset for help on using the changeset viewer.