Changeset 14584 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 24 Feb 2017, 06:53:41 (8 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r14582 r14584 146 146 ticket.automatic = False 147 147 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") 151 151 return False 152 152 try: … … 2732 2732 return 2733 2733 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") 2737 2737 return 2738 2738 msg = self.context.course_registration_forbidden -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r14583 r14584 154 154 """ 155 155 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. 158 159 """ 159 160 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r14582 r14584 824 824 self.browser.getControl("Add course ticket").click() 825 825 self.assertMatches( 826 '... Totalcredits exceeded...', self.browser.contents)826 '...Maximum credits exceeded...', self.browser.contents) 827 827 self.course.credits = 10 828 828 self.browser.getControl("Add course ticket").click() … … 2510 2510 self.browser.getControl("Add course ticket").click() 2511 2511 self.assertMatches( 2512 '... Totalcredits exceeded...', self.browser.contents)2512 '...Maximum credits exceeded...', self.browser.contents) 2513 2513 self.course.credits = 10 2514 2514 self.browser.getControl("Add course ticket").click() … … 2605 2605 # Carryover COURSE1 in level 200 already has 10 credits 2606 2606 self.assertMatches( 2607 '... Totalcredits exceeded...', self.browser.contents)2607 '...Maximum credits exceeded...', self.browser.contents) 2608 2608 # If COURSE1 is outstanding, its credits won't be considered 2609 2609 self.student['studycourse']['200']['COURSE1'].outstanding = True -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r14583 r14584 1010 1010 return pdf_stream 1011 1011 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. 1014 1015 """ 1015 1016 if course and studylevel.total_credits + course.credits > 50: 1016 return True1017 return _('Maximum credits exceeded.') 1017 1018 elif studylevel.total_credits > 50: 1018 return True1019 return _('Maximum credits exceeded.') 1019 1020 return False 1020 1021
Note: See TracChangeset for help on using the changeset viewer.