Ignore:
Timestamp:
1 Nov 2023, 17:59:53 (14 months ago)
Author:
Henrik Bettermann
Message:

See ticket #773.

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  
    2424from zope.catalog.interfaces import ICatalog
    2525from hurry.workflow.interfaces import IWorkflowState
     26from zope.component import queryUtility
     27from zope.catalog.interfaces import ICatalog
    2628from waeup.kofa.interfaces import (
    2729    IExtFileStore, IFileStoreNameChooser, IKofaUtils)
     
    609611            self.emit_lock_message()
    610612            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:
    614644            self.flash(_('2nd choice course must differ from 1st choice course.'),
    615645                       type='danger')
    616646            self.redirect(self.url(self.context))
    617647            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:
    621649            self.flash(_('3rd choice course must differ from 1st choice course.'),
    622650                       type='danger')
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py

    r17627 r17632  
    154154
    155155    course1 = schema.Choice(
    156         title = _(u'1st Choice Course of Study'),
     156        title = _(u'1st Choice Course of Study (JAMB Course)'),
    157157        source = AppCatCertificateSource(),
    158158        required = False,
     
    555555    @invariant
    556556    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)))
    578557
    579558        if applicant.course1 == applicant.course2:
     
    16171596
    16181597    course1 = schema.Choice(
    1619         title = _(u'1st Choice Course of Study'),
     1598        title = _(u'1st Choice Course of Study (JAMB Course)'),
    16201599        source = AppCatCertificateSource(),
    16211600        required = True,
     
    16751654    # and no Invalid exception is raised.
    16761655    # 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.
    16781658    @invariant
    16791659    def course_choice(applicant):
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py

    r16548 r17632  
    7474        self.app['configuration'].addSessionConfiguration(configuration)
    7575        self.applicantscontainer.application_fee = 200.0
     76        self.applicant.jamb_score = 1000000
    7677        self.login()
    7778        self.browser.open(self.edit_path)
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py

    r17627 r17632  
    5353    SEPARATORS_DICT = {
    5454        'form.applicant_id': _(u'Base Data'),
    55         'form.course1': _(u'JAMB Course: '),
     55        #'form.course1': _(u'JAMB Course: '),
    5656        'form.fst_sit_fname': _(u'1st Sitting'),
    5757        'form.scd_sit_fname': _(u'2nd Sitting'),
Note: See TracChangeset for help on using the changeset viewer.