Changeset 16931
- Timestamp:
- 21 Apr 2022, 08:07:31 (3 years ago)
- Location:
- main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/browser.py
r16926 r16931 213 213 def _students_per_school_exceeded(self, data): 214 214 container = self.context.__parent__ 215 counter = 0 215 counter_school = 0 216 counter_subj_per_school = 0 216 217 target = getattr(container, 'prefix', None) 217 218 if target == 'tpu': 218 219 school = 'school_tpu' 219 max = 10 220 else: 221 max = 7 220 max_schools = 10 221 max_subj_per_school = 1 222 else: 223 max_schools = 7 224 max_subj_per_school = 2 222 225 school = 'school_utp' 223 226 for appl in container.values(): … … 225 228 and appl.state in (SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED): 226 229 if getattr(appl, school) == data.get(school): 227 counter += 1230 counter_school += 1 228 231 if appl.subj_comb == data.get('subj_comb'): 232 counter_subj_per_school += 1 233 if counter_subj_per_school == max_subj_per_school: 229 234 return True 230 if counter == max:235 if counter_school == max_schools: 231 236 return True 232 237 return False -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests/test_browser.py
r16928 r16931 369 369 self.browser.getControl(name="form.subj_comb").value = ['BEDCERT1'] 370 370 self.browser.getControl("Finally Submit").click() 371 self.assertTrue("Maximum number of applications per school exceeded." 372 in self.browser.contents) 373 # Same school with another subj_comb can be submitted 374 self.assertEqual(self.utpapplicant.state, 'paid') 375 self.browser.open(self.utpapplicant_path + '/edit') 376 self.browser.getControl(name="form.school_utp").value = ['utp0012'] 377 self.browser.getControl(name="form.subj_comb").value = ['BEDCERT2'] 378 self.browser.getControl("Finally Submit").click() 371 # UTP applications allow two, one is not enough 379 372 self.assertEqual(self.utpapplicant.state, 'submitted') 380 373 return
Note: See TracChangeset for help on using the changeset viewer.