Ignore:
Timestamp:
24 Feb 2017, 09:25:22 (8 years ago)
Author:
Henrik Bettermann
Message:

Replace maxCreditsExceeded by warnCreditsOOR.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_utils.py

    r14566 r14586  
    3737        course = grok.Model()
    3838        course.credits = 18
    39         max_credits = students_utils.maxCreditsExceeded(studylevel, course)
    40         self.assertEqual(max_credits, 0)
     39        warning = students_utils.warnCreditsOOR(studylevel, course)
     40        self.assertEqual(warning, None)
    4141        course.credits = 19
    42         max_credits = students_utils.maxCreditsExceeded(studylevel, course)
    43         self.assertEqual(max_credits, 58)
     42        warning = students_utils.warnCreditsOOR(studylevel, course)
     43        self.assertEqual(warning, 'Maximum credits exceeded.')
    4444        return
    4545
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py

    r14566 r14586  
    361361        return d
    362362
    363     def maxCredits(self, studylevel):
    364         """Return maximum credits.
    365 
    366         """
    367         return 58
     363    def warnCreditsOOR(self, studylevel, course=None):
     364        """Return message if credits are out of range. In the base
     365        package only maximum credits is set.
     366        """
     367        if course and studylevel.total_credits + course.credits > 58:
     368            return _('Maximum credits exceeded.')
     369        elif studylevel.total_credits > 58:
     370            return _('Maximum credits exceeded.')
     371        return
    368372
    369373    def getPDFCreator(self, context):
Note: See TracChangeset for help on using the changeset viewer.