Changeset 14617 for main/waeup.fceokene


Ignore:
Timestamp:
9 Mar 2017, 16:33:34 (8 years ago)
Author:
Henrik Bettermann
Message:

Fresh students don't have to pay penalty fee.

Revert to old rule for maximum credits per session.

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

    r14591 r14617  
    3131        return
    3232
    33     def test_warnCreditsOOR(self):
     33    def disabled_test_warnCreditsOOR_semester_exceeded(self):
    3434        students_utils = getUtility(IStudentsUtils)
    3535        studylevel = grok.Container()
     
    5454        return
    5555
     56    def test_warnCreditsOOR(self):
     57        students_utils = getUtility(IStudentsUtils)
     58        studylevel = grok.Container()
     59        studylevel.total_credits = 45
     60        course = grok.Model()
     61        course.credits = 7
     62        warning = students_utils.warnCreditsOOR(studylevel, course)
     63        self.assertEqual(warning, None)
     64        course.credits = 8
     65        warning = students_utils.warnCreditsOOR(studylevel, course)
     66        self.assertEqual(warning, 'Maximum credits exceeded.')
     67        studylevel.total_credits_s1 = 17
     68        warning = students_utils.warnCreditsOOR(studylevel)
     69        self.assertEqual(warning, 'Minimum credits in 1st semester not reached.')
     70        return
     71
    5672    def test_set_payment_details(self):
    5773        self.certificate.end_level = 300
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py

    r14591 r14617  
    280280        # Add session and level specific penalty fee.
    281281        if category == 'schoolfee' and student.current_mode in (
    282             'ug_ft', 'de_ft'):
     282            'ug_ft', 'de_ft') and student.state != CLEARED:
    283283            amount += academic_session.penalty_ug_ft
    284284        elif category == 'schoolfee' and student.current_mode in (
     
    361361        return d
    362362
     363    #def warnCreditsOOR(self, studylevel, course=None):
     364    #    """Return message if credits are out of range.
     365    #    """
     366    #    # adding a course ticket
     367    #    if course:
     368    #        if course.semester == 1:
     369    #            if studylevel.total_credits_s1 + course.credits > 24:
     370    #                return _('Maximum credits in 1st semester exceeded.')
     371    #        if course.semester == 2:
     372    #            if studylevel.total_credits_s2 + course.credits > 24:
     373    #                return _('Maximum credits in 2nd semester exceeded.')
     374    #    # registering course list
     375    #    else:
     376    #        if studylevel.total_credits_s1 > 24:
     377    #            return _('Maximum credits in 1st semester exceeded.')
     378    #        if studylevel.total_credits_s1 < 18:
     379    #            return _('Minimum credits in 1st semester not reached.')
     380    #        if studylevel.total_credits_s2 > 24:
     381    #            return _('Maximum credits in 2nd semester exceeded.')
     382    #        if studylevel.total_credits_s2 < 18:
     383    #            return _('Minimum credits in 2nd semester not reached.')
     384    #    return
     385
    363386    def warnCreditsOOR(self, studylevel, course=None):
    364387        """Return message if credits are out of range.
     
    366389        # adding a course ticket
    367390        if course:
    368             if course.semester == 1:
    369                 if studylevel.total_credits_s1 + course.credits > 24:
    370                     return _('Maximum credits in 1st semester exceeded.')
    371             if course.semester == 2:
    372                 if studylevel.total_credits_s2 + course.credits > 24:
    373                     return _('Maximum credits in 2nd semester exceeded.')
     391            if studylevel.total_credits + course.credits > 52:
     392                return _('Maximum credits exceeded.')
    374393        # registering course list
    375394        else:
    376             if studylevel.total_credits_s1 > 24:
    377                 return _('Maximum credits in 1st semester exceeded.')
     395            if studylevel.total_credits > 52:
     396                return _('Maximum credits exceeded.')
    378397            if studylevel.total_credits_s1 < 18:
    379398                return _('Minimum credits in 1st semester not reached.')
    380             if studylevel.total_credits_s2 > 24:
    381                 return _('Maximum credits in 2nd semester exceeded.')
    382399            if studylevel.total_credits_s2 < 18:
    383400                return _('Minimum credits in 2nd semester not reached.')
Note: See TracChangeset for help on using the changeset viewer.