Changeset 14733


Ignore:
Timestamp:
30 Jul 2017, 07:34:57 (7 years ago)
Author:
Henrik Bettermann
Message:

Final year students maximum credit units = 52

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

Legend:

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

    r14585 r14733  
    1919from hurry.workflow.interfaces import IWorkflowState
    2020from zope.component import getUtility, createObject
     21from waeup.kofa.students.studylevel import StudentStudyLevel
    2122from waeup.kofa.students.tests.test_browser import StudentsFullSetup
    2223from waeup.kofa.students.interfaces import IStudentsUtils
     
    139140
    140141    def test_maxCreditsExceeded(self):
     142        # non-final-year student
    141143        students_utils = getUtility(IStudentsUtils)
    142144        studylevel = grok.Container()
    143145        studylevel.total_credits = 30
     146        studylevel.level = 100
     147        self.student['studycourse']['100'] = studylevel
    144148        course = grok.Model()
    145149        course.credits = 18
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r14663 r14733  
    447447
    448448    def warnCreditsOOR(self, studylevel, course=None):
    449         if course and studylevel.total_credits + course.credits > 48:
     449        studycourse = studylevel.__parent__
     450        certificate = getattr(studycourse,'certificate', None)
     451        current_level = studycourse.current_level
     452        if None in (current_level, certificate):
     453            return
     454        end_level = certificate.end_level
     455        if current_level >= end_level:
     456            limit = 52
     457        else:
     458            limit = 48
     459        if course and studylevel.total_credits + course.credits > limit:
    450460            return  _('Maximum credits exceeded.')
    451         elif studylevel.total_credits > 48:
     461        elif studylevel.total_credits > limit:
    452462            return _('Maximum credits exceeded.')
    453463        return
Note: See TracChangeset for help on using the changeset viewer.