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

See ticket #773.

File:
1 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')
Note: See TracChangeset for help on using the changeset viewer.