Changeset 9831
- Timestamp:
- 5 Jan 2013, 22:45:40 (12 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py
r9796 r9831 28 28 # If you enable this, please make sure the external services 29 29 # do exist really and are not bothered by being spammed by a test programme. 30 EXTERNAL_TESTS = True30 EXTERNAL_TESTS = False 31 31 32 32 def external_test(func): -
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r9775 r9831 193 193 self.redirect(self.url(self.context)) 194 194 return 195 if self.context.total_credits > self.max_credits: 195 students_utils = getUtility(IStudentsUtils) 196 max_credits = students_utils.maxCredits(self.context) 197 if self.context.total_credits > max_credits: 196 198 self.flash(_('Maximum credits of ${a} exceeded.', 197 mapping = {'a': self.max_credits}))199 mapping = {'a':max_credits})) 198 200 return 199 201 IWorkflowInfo(self.context.student).fireTransition( -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r9765 r9831 687 687 self.browser.contents) 688 688 self.browser.getControl("Create course list now").click() 689 # A level with onecourse ticket was created689 # A level with no course ticket was created 690 690 self.assertEqual(self.student['studycourse']['700'].number_of_tickets, 0) 691 691 self.browser.getLink("700").click() … … 693 693 self.browser.getControl("Add course ticket").click() 694 694 self.browser.getControl(name="form.course").value = ['COURSE1'] 695 # Non-final year students can't add ticket with 51 credits 696 self.app['faculties']['fac1']['dep1'].courses['COURSE1'].credits = 51 697 self.browser.getControl("Add course ticket").click() 698 self.assertMatches('...Your total credits exceed 50...', 699 self.browser.contents) 700 # Final year students can't add ticket with 52 credits ... 701 self.app['faculties']['fac1']['dep1'].courses['COURSE1'].credits = 52 702 self.student['studycourse'].certificate.end_level = 700 703 self.browser.getControl("Add course ticket").click() 704 self.assertMatches('...Your total credits exceed 51...', 705 self.browser.contents) 706 # ... but with 51 credits 707 self.app['faculties']['fac1']['dep1'].courses['COURSE1'].credits = 51 695 708 self.browser.getControl("Add course ticket").click() 696 709 self.assertMatches('...Successfully added COURSE1...', 697 710 self.browser.contents) 698 # Special postgraduate students can register course lists 711 # Non-final year special postgraduate students can't register 712 # course lists if their total credits are 51 and thus exceed 50 ... 713 self.student['studycourse'].certificate.end_level = 800 714 self.browser.getControl("Register course list").click() 715 self.assertMatches('...Maximum credits of 50 exceeded...', 716 self.browser.contents) 717 # ... but final year students can 718 self.student['studycourse'].certificate.end_level = 700 699 719 self.browser.getControl("Register course list").click() 700 720 self.assertMatches('...Course list has been registered...', -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r9796 r9831 225 225 return None, payment 226 226 227 def maxCredits(self, studylevel): 228 """Return maximum credits. 229 230 """ 231 studycourse = studylevel.__parent__ 232 certificate = getattr(studycourse,'certificate', None) 233 current_level = studycourse.current_level 234 if None in (current_level, certificate): 235 return 0 236 end_level = certificate.end_level 237 if current_level >= end_level: 238 return 51 239 return 50 240 227 241 # Uniben prefix 228 242 STUDENT_ID_PREFIX = u'B'
Note: See TracChangeset for help on using the changeset viewer.