Changeset 9830
- Timestamp:
- 5 Jan 2013, 18:41:35 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9822 r9830 2237 2237 'level_session', 'level_verdict') 2238 2238 pnav = 4 2239 max_credits = 502240 2239 2241 2240 def update(self): … … 2306 2305 self.redirect(self.url(self.context)) 2307 2306 return 2308 if self.context.total_credits > self.max_credits: 2307 students_utils = getUtility(IStudentsUtils) 2308 max_credits = students_utils.maxCredits(self.context) 2309 if self.context.total_credits > max_credits: 2309 2310 self.flash(_('Maximum credits of ${a} exceeded.', 2310 mapping = {'a': self.max_credits}))2311 mapping = {'a':max_credits})) 2311 2312 return 2312 2313 IWorkflowInfo(self.context.student).fireTransition( -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9823 r9830 755 755 self.browser.getControl("Add course ticket").click() 756 756 self.assertMatches( 757 '...Total credits exceed 5 8...', self.browser.contents)757 '...Total credits exceed 50...', self.browser.contents) 758 758 self.course.credits = 10 759 759 self.browser.getControl("Add course ticket").click() … … 2029 2029 self.browser.getControl("Add course ticket").click() 2030 2030 self.assertMatches( 2031 '...Your total credits exceed 5 8...', self.browser.contents)2031 '...Your total credits exceed 50...', self.browser.contents) 2032 2032 self.course.credits = 10 2033 2033 self.browser.getControl("Add course ticket").click() -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r9762 r9830 586 586 return pdf_stream 587 587 588 TOTAL_CREDITS = 58 588 def maxCredits(self, studylevel): 589 """Return maximum credits. 590 591 In some universities maximum credits is not constant, it 592 depends on the student's study level. 593 """ 594 return 50 589 595 590 596 def maxCreditsExceeded(self, studylevel, course): 591 if self.TOTAL_CREDITS and \ 592 studylevel.total_credits + course.credits > self.TOTAL_CREDITS: 593 return self.TOTAL_CREDITS 597 max_credits = self.maxCredits(studylevel) 598 if max_credits and \ 599 studylevel.total_credits + course.credits > max_credits: 600 return max_credits 594 601 return 0 595 602
Note: See TracChangeset for help on using the changeset viewer.