Ignore:
Timestamp:
24 Feb 2017, 06:53:41 (8 years ago)
Author:
Henrik Bettermann
Message:

Replace maxCreditsExceeded by warnCreditsOOR.

Location:
main/waeup.kofa/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r14582 r14584  
    55=======================
    66
    7 * Simplify configuration of maximum credits.
     7* Simplify configuration of maximum or minimum total credits.
    88
    99* Add `outstanding` attribute to course tickets.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r14582 r14584  
    146146    ticket.automatic = False
    147147    ticket.carry_over = False
    148     max_credits = students_utils.maxCreditsExceeded(view.context, course)
    149     if max_credits:
    150         view.flash(_('Total credits exceeded.'), type="warning")
     148    warning = students_utils.warnCreditsOOR(view.context, course)
     149    if warning:
     150        view.flash(warning, type="warning")
    151151        return False
    152152    try:
     
    27322732            return
    27332733        students_utils = getUtility(IStudentsUtils)
    2734         max_credits = students_utils.maxCreditsExceeded(self.context)
    2735         if max_credits:
    2736             self.flash(_('Maximum credits exceeded.'), type="warning")
     2734        warning = students_utils.warnCreditsOOR(self.context)
     2735        if warning:
     2736            self.flash(warning, type="warning")
    27372737            return
    27382738        msg = self.context.course_registration_forbidden
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r14583 r14584  
    154154        """
    155155
    156     def maxCreditsExceeded(studylevel, course=None):
    157         """Return True if maximum credits is exceeded.
     156    def warnCreditsOOR(studylevel, course=None):
     157        """Return message if credits are out of range. In the base
     158        package only maximum credits is set.
    158159        """
    159160
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r14582 r14584  
    824824        self.browser.getControl("Add course ticket").click()
    825825        self.assertMatches(
    826             '...Total credits exceeded...', self.browser.contents)
     826            '...Maximum credits exceeded...', self.browser.contents)
    827827        self.course.credits = 10
    828828        self.browser.getControl("Add course ticket").click()
     
    25102510        self.browser.getControl("Add course ticket").click()
    25112511        self.assertMatches(
    2512             '...Total credits exceeded...', self.browser.contents)
     2512            '...Maximum credits exceeded...', self.browser.contents)
    25132513        self.course.credits = 10
    25142514        self.browser.getControl("Add course ticket").click()
     
    26052605        # Carryover COURSE1 in level 200 already has 10 credits
    26062606        self.assertMatches(
    2607             '...Total credits exceeded...', self.browser.contents)
     2607            '...Maximum credits exceeded...', self.browser.contents)
    26082608        # If COURSE1 is outstanding, its credits won't be considered
    26092609        self.student['studycourse']['200']['COURSE1'].outstanding = True
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r14583 r14584  
    10101010        return pdf_stream
    10111011
    1012     def maxCreditsExceeded(self, studylevel, course=None):
    1013         """Return True if maximum credits is exceeded.
     1012    def warnCreditsOOR(self, studylevel, course=None):
     1013        """Return message if credits are out of range. In the base
     1014        package only maximum credits is set.
    10141015        """
    10151016        if course and studylevel.total_credits + course.credits > 50:
    1016             return True
     1017            return _('Maximum credits exceeded.')
    10171018        elif studylevel.total_credits > 50:
    1018             return True
     1019            return _('Maximum credits exceeded.')
    10191020        return False
    10201021
Note: See TracChangeset for help on using the changeset viewer.