Changeset 15635 for main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
- Timestamp:
- 3 Oct 2019, 20:47:58 (5 years ago)
- Location:
- main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/browser.py
r15027 r15635 197 197 return form_fields 198 198 199 @property 200 def _student_per_school_exceeded(self): 199 def _student_per_school_exceeded(self, data): 201 200 container = self.context.__parent__ 202 201 counter = 0 203 if self.context.school1:204 for appl in container.values():205 if appl.state in (SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED)\206 and appl.school1 == self.context.school1:207 208 209 202 for appl in container.values(): 203 if appl.state in (SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED) \ 204 and (appl.school1 == self.context.school1 \ 205 or appl.school1 == data.get('school1')): 206 counter += 1 207 if counter == 10: 208 return True 210 209 return False 211 210 212 def dataNotComplete(self ):213 if self._student_per_school_exceeded :211 def dataNotComplete(self, data): 212 if self._student_per_school_exceeded(data): 214 213 return ("1st Choice TPZ and School: " 215 214 "Maximum number of applications per school exceeded. " 216 215 "Please select another first choice school.") 217 super(CustomApplicantEditFormPage, self).dataNotComplete( )216 super(CustomApplicantEditFormPage, self).dataNotComplete(data) 218 217 return -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py
r15594 r15635 161 161 ) 162 162 163 #school2 = schema.Choice(164 # title = _(u'2nd Choice TPZ and School'),165 # source = SchoolSource(),166 # required = False,167 # )168 169 #school3 = schema.Choice(170 # title = _(u'3rd Choice TPZ and School'),171 # source = SchoolSource(),172 # required = False,173 # )174 175 163 class ICustomUGApplicant(INigeriaUGApplicant): 176 164 """An undergraduate applicant. -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests/test_browser.py
r15027 r15635 189 189 self.assertEqual(self.browser.headers['Status'], '200 Ok') 190 190 191 192 191 def test_final_submit_tpu(self): 193 192 IWorkflowState(self.tpuapplicant).setState('paid') … … 209 208 self.assertTrue( 210 209 'Application submitted' in self.browser.contents) 211 # Create 20 applicants who already selected s0010210 # Create 10 applicants who already selected s0010 212 211 for i in range(1,11): 213 tpuapplicant= createObject(u'waeup.Applicant')214 tpuapplicant.firstname = u'John'215 tpuapplicant.lastname = u'Doe %s' %i216 tpuapplicant.school1 = 's0010'212 dummy = createObject(u'waeup.Applicant') 213 dummy.firstname = u'John' 214 dummy.lastname = u'Doe %s' %i 215 dummy.school1 = 's0010' 217 216 self.app['applicants'][ 218 self.tpucontainer.code].addApplicant( tpuapplicant)219 IWorkflowState( tpuapplicant).setState('submitted')217 self.tpucontainer.code].addApplicant(dummy) 218 IWorkflowState(dummy).setState('submitted') 220 219 IWorkflowState(self.tpuapplicant).setState('paid') 220 self.tpuapplicant.school1 = None 221 221 self.tpuapplicant.locked = False 222 222 self.browser.open(self.tpuapplicant_path + '/edit') 223 self.browser.getControl(name="form.school1").value = ['s0010'] 223 224 self.browser.getControl("Finally Submit").click() 224 225 self.assertTrue("Maximum number of applications per school exceeded."
Note: See TracChangeset for help on using the changeset viewer.