Ignore:
Timestamp:
3 Feb 2017, 07:54:44 (8 years ago)
Author:
Henrik Bettermann
Message:

Restrict maximum number of applications per school.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/browser.py

    r13877 r14499  
    2828from waeup.kofa.interfaces import IKofaUtils
    2929from waeup.kofa.browser.interfaces import IPDFCreator
     30from waeup.kofa.applicants.workflow import (
     31    SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED)
    3032
    3133from kofacustom.nigeria.applicants.browser import (
     
    194196        form_fields['reg_number'].for_display = True
    195197        return form_fields
     198
     199    @property
     200    def _student_per_school_exceeded(self):
     201        container = self.context.__parent__
     202        counter = 0
     203        if self.context.school1:
     204            for appl in container.values():
     205                if appl.state in (SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED) \
     206                    and appl.school1 == self.context.school1:
     207                    counter += 1
     208                    if counter == 20:
     209                        return True
     210        return False
     211
     212    def dataNotComplete(self):
     213        if self._student_per_school_exceeded:
     214            return ("1st Choice TPZ and School: "
     215                    "Maximum number of applications per school exceeded. "
     216                    "Please select another first choice school.")
     217        super(CustomApplicantEditFormPage, self).dataNotComplete()
     218        return
Note: See TracChangeset for help on using the changeset viewer.