Changeset 16931 for main/waeup.fceokene


Ignore:
Timestamp:
21 Apr 2022, 08:07:31 (3 years ago)
Author:
Henrik Bettermann
Message:

Allow two identical subject/school combinations.

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  
    213213    def _students_per_school_exceeded(self, data):
    214214        container = self.context.__parent__
    215         counter = 0
     215        counter_school = 0
     216        counter_subj_per_school = 0
    216217        target = getattr(container, 'prefix', None)
    217218        if target == 'tpu':
    218219            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
    222225            school = 'school_utp'
    223226        for appl in container.values():
     
    225228                and appl.state in (SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED):
    226229                if getattr(appl, school) == data.get(school):
    227                     counter += 1
     230                    counter_school += 1
    228231                    if appl.subj_comb == data.get('subj_comb'):
     232                        counter_subj_per_school += 1
     233                    if counter_subj_per_school == max_subj_per_school:
    229234                        return True
    230                 if counter == max:
     235                if counter_school == max_schools:
    231236                    return True
    232237        return False
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests/test_browser.py

    r16928 r16931  
    369369        self.browser.getControl(name="form.subj_comb").value = ['BEDCERT1']
    370370        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
    379372        self.assertEqual(self.utpapplicant.state, 'submitted')
    380373        return
Note: See TracChangeset for help on using the changeset viewer.