Ignore:
Timestamp:
19 Apr 2022, 12:11:11 (3 years ago)
Author:
Henrik Bettermann
Message:

Only 7 schools are allowed.

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

    r16918 r16925  
    214214        container = self.context.__parent__
    215215        counter = 0
     216        target = getattr(container, 'prefix', None)
     217        if target == 'tpu':
     218            max = 10
     219        else:
     220            max = 7
    216221        for appl in container.values():
    217222            if appl != self.context \
     
    221226                    if appl.subj_comb == data.get('subj_comb'):
    222227                        return True
    223                 if counter == 10:
     228                if counter == max:
    224229                    return True
    225230        return False
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/schools_utp.py

    r16918 r16925  
    55    'utp0004': ('Zone 01','Otite, Ogaminana, Obangede','Ebira Community Secondary School, Ogaminana'),
    66    'utp0005': ('Zone 01','Otite, Ogaminana, Obangede','Government Science Secondary School, Ogaminana '),
    7     'utp0006': ('Zone 01','Otite, Ogaminana, Obangede','beside Audu Wokili Academy, Nagazi Uvete'),
     7    'utp0006': ('Zone 01','Otite, Ogaminana, Obangede','Audu Wokili Academy, Nagazi Uvete'),
    88    'utp0007': ('Zone 01','Otite, Ogaminana, Obangede','Acess Secondary school, nagazi uvete'),
    99    'utp0008': ('Zone 01','Otite, Ogaminana, Obangede','Government Girls Secondary School, Otutu'),
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests/test_browser.py

    r16918 r16925  
    192192       
    193193    def test_final_submit_tpu(self):
    194         self.certificate.application_category = 'basic'
    195         self.certificate.title = 'NCECert1'
    196         notify(grok.ObjectModifiedEvent(self.certificate))
     194        # Create NCE certificate
     195        certificate1 = createObject('waeup.Certificate')
     196        certificate1.application_category = 'basic'
     197        certificate1.code = 'NCECERT1'
     198        certificate1.title = 'NCECert1'
     199        certificate1.start_level = 100
     200        certificate1.end_level = 500
     201        certificate1.study_mode = u'nce_ft'
     202        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
     203            certificate1)
    197204        IWorkflowState(self.tpuapplicant).setState('paid')
    198205        self.browser.open(self.login_path)
     
    204211        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    205212        self.browser.getControl(name="form.school").value = ['tpu0010']
    206         self.browser.getControl(name="form.subj_comb").value = ['CERT1']
     213        self.browser.getControl(name="form.subj_comb").value = ['NCECERT1']
    207214        image = open(SAMPLE_IMAGE, 'rb')
    208215        ctrl = self.browser.getControl(name='form.passport')
     
    224231            IWorkflowState(dummy).setState('submitted')
    225232        IWorkflowState(self.tpuapplicant).setState('paid')
    226         self.tpuapplicant.school = None
    227233        self.tpuapplicant.locked = False
    228234        self.browser.open(self.tpuapplicant_path + '/edit')
     
    233239        self.assertEqual(self.tpuapplicant.state, 'paid')
    234240        # Create second certificate
    235         certificate = createObject('waeup.Certificate')
    236         certificate.code = 'CERT2'
    237         certificate.title = 'NCECert2'
    238         certificate.application_category = 'basic'
    239         certificate.start_level = 100
    240         certificate.end_level = 500
    241         certificate.study_mode = u'nce_ft'
     241        certificate2 = createObject('waeup.Certificate')
     242        certificate2.code = 'NCECERT2'
     243        certificate2.title = 'NCECert2'
     244        certificate2.application_category = 'basic'
     245        certificate2.start_level = 100
     246        certificate2.end_level = 500
     247        certificate2.study_mode = u'nce_ft'
    242248        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    243             certificate)
     249            certificate2)
    244250        # Create one applicant with same subject and same school
    245251        dummy = createObject(u'waeup.Applicant')
     
    247253        dummy.lastname = u'Doe %s' %i
    248254        dummy.school = 'tpu0012'
    249         dummy.subj_comb = self.certificate
     255        dummy.subj_comb = certificate1
    250256        self.app['applicants'][
    251257            self.tpucontainer.code].addApplicant(dummy)
     
    253259        self.browser.open(self.tpuapplicant_path + '/edit')
    254260        self.browser.getControl(name="form.school").value = ['tpu0012']
    255         self.browser.getControl(name="form.subj_comb").value = ['CERT1']
     261        self.browser.getControl(name="form.subj_comb").value = ['NCECERT1']
    256262        self.browser.getControl("Finally Submit").click()
    257263        self.assertTrue("Maximum number of applications per school exceeded."
     
    261267        self.browser.open(self.tpuapplicant_path + '/edit')
    262268        self.browser.getControl(name="form.school").value = ['tpu0012']
    263         self.browser.getControl(name="form.subj_comb").value = ['CERT2']
     269        self.browser.getControl(name="form.subj_comb").value = ['NCECERT2']
    264270        self.browser.getControl("Finally Submit").click()
    265271        self.assertEqual(self.tpuapplicant.state, 'submitted')
Note: See TracChangeset for help on using the changeset viewer.