Changeset 17632 for main/waeup.aaue/trunk/src/waeup/aaue/applicants
- Timestamp:
- 1 Nov 2023, 17:59:53 (13 months ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/applicants
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py
r16871 r17632 24 24 from zope.catalog.interfaces import ICatalog 25 25 from hurry.workflow.interfaces import IWorkflowState 26 from zope.component import queryUtility 27 from zope.catalog.interfaces import ICatalog 26 28 from waeup.kofa.interfaces import ( 27 29 IExtFileStore, IFileStoreNameChooser, IKofaUtils) … … 609 611 self.emit_lock_message() 610 612 return 611 if getattr( 612 self.context.course1, 'code', 'nocourse') == self.request.form.get( 613 'form.course2', None): 613 course1_in_form = self.request.form.get('form.course1', None) 614 course2_in_form = self.request.form.get('form.course2', None) 615 course3_in_form = self.request.form.get('form.course3', None) 616 cat = queryUtility(ICatalog, name='certificates_catalog') 617 if course2_in_form: 618 if not self.context.jamb_score: 619 self.flash(("Total JAMB score not set."), type='danger') 620 self.redirect(self.url(self.context)) 621 return 622 results = list( 623 cat.searchResults(code=(course2_in_form, course2_in_form))) 624 cutoff = getattr(results[0], 'custom_float_1') 625 if cutoff and cutoff > self.context.jamb_score: 626 self.flash("You do not meet the minimum cutoff mark for your 2nd choice course. Please consider selecting an alternative choice.", 627 type='danger') 628 self.redirect(self.url(self.context)) 629 return 630 if course3_in_form: 631 if not self.context.jamb_score: 632 self.flash(("Total JAMB score not set."), type='danger') 633 self.redirect(self.url(self.context)) 634 return 635 results = list( 636 cat.searchResults(code=(course3_in_form, course3_in_form))) 637 cutoff = getattr(results[0], 'custom_float_1') 638 if cutoff and cutoff > self.context.jamb_score: 639 self.flash("You do not meet the minimum cutoff mark for your 3rd choice course. Please consider selecting an alternative choice.", 640 type='danger') 641 self.redirect(self.url(self.context)) 642 return 643 if getattr(self.context.course1, 'code', 'nocourse') == course2_in_form: 614 644 self.flash(_('2nd choice course must differ from 1st choice course.'), 615 645 type='danger') 616 646 self.redirect(self.url(self.context)) 617 647 return 618 if getattr( 619 self.context.course1, 'code', 'nocourse') == self.request.form.get( 620 'form.course3', None): 648 if getattr(self.context.course1, 'code', 'nocourse') == course3_in_form: 621 649 self.flash(_('3rd choice course must differ from 1st choice course.'), 622 650 type='danger') -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py
r17627 r17632 154 154 155 155 course1 = schema.Choice( 156 title = _(u'1st Choice Course of Study '),156 title = _(u'1st Choice Course of Study (JAMB Course)'), 157 157 source = AppCatCertificateSource(), 158 158 required = False, … … 555 555 @invariant 556 556 def course_choice(applicant): 557 558 if applicant.course1:559 if applicant.jamb_score is None:560 raise Invalid(_("Total JAMB score not set."))561 if applicant.course1.custom_float_1 and applicant.course1.custom_float_1 > applicant.jamb_score:562 raise Invalid(_("You do not meet the minimum cutoff mark for course %s. Cutoff score for this course is %s. Please consider selecting an alternative choice." % (563 applicant.course1.code, applicant.course1.custom_float_1)))564 565 if applicant.course2:566 if applicant.jamb_score is None:567 raise Invalid(_("Total JAMB score not set."))568 if applicant.course2.custom_float_1 and applicant.course2.custom_float_1 > applicant.jamb_score:569 raise Invalid(_("You do not meet the minimum cutoff mark for course %s. Cutoff score for this course is %s. Please consider selecting an alternative choice." % (570 applicant.course2.code, applicant.course2.custom_float_1)))571 572 if applicant.course3:573 if applicant.jamb_score is None:574 raise Invalid(_("Total JAMB score not set."))575 if applicant.course3.custom_float_1 and applicant.course3.custom_float_1 > applicant.jamb_score:576 raise Invalid(_("You do not meet the minimum cutoff mark for course %s. Cutoff score for this course is %s. Please consider selecting an alternative choice." % (577 applicant.course3.code, applicant.course3.custom_float_1)))578 557 579 558 if applicant.course1 == applicant.course2: … … 1617 1596 1618 1597 course1 = schema.Choice( 1619 title = _(u'1st Choice Course of Study '),1598 title = _(u'1st Choice Course of Study (JAMB Course)'), 1620 1599 source = AppCatCertificateSource(), 1621 1600 required = True, … … 1675 1654 # and no Invalid exception is raised. 1676 1655 # NoInputData: NoInputD...course1' 1677 # Therefore, we check and compare course1 on CustomApplicantEditFormPage. 1656 # Therefore, we check and compare course1 on CustomApplicantEditFormPage. We 1657 # do also cherck if the course choices meet tmeet the minimum cutoff mark for course. 1678 1658 @invariant 1679 1659 def course_choice(applicant): -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py
r16548 r17632 74 74 self.app['configuration'].addSessionConfiguration(configuration) 75 75 self.applicantscontainer.application_fee = 200.0 76 self.applicant.jamb_score = 1000000 76 77 self.login() 77 78 self.browser.open(self.edit_path) -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py
r17627 r17632 53 53 SEPARATORS_DICT = { 54 54 'form.applicant_id': _(u'Base Data'), 55 'form.course1': _(u'JAMB Course: '),55 #'form.course1': _(u'JAMB Course: '), 56 56 'form.fst_sit_fname': _(u'1st Sitting'), 57 57 'form.scd_sit_fname': _(u'2nd Sitting'),
Note: See TracChangeset for help on using the changeset viewer.