Ignore:
Timestamp:
2 May 2012, 11:54:22 (13 years ago)
Author:
Henrik Bettermann
Message:

Specify may_register for Uniben.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/studycourse.py

    r8326 r8328  
    3737    @property
    3838    def may_register(self):
    39         return True
     39        if self.previous_verdict in (
     40            'A','B','C','F','J','L','M','N','O','X','Z') or \
     41            self.current_level in (0, 100) or\
     42            (self.__parent__.current_mode.startswith('de') and self.current_level == 200) or \
     43            (self.__parent__.current_mode.startswith('ph') and self.current_level == 300):
     44            return True
     45        return False
    4046
    4147CustomStudentStudyCourse = attrs_to_fields(CustomStudentStudyCourse)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r8326 r8328  
    113113        ticket = createObject(u'waeup.CourseTicket')
    114114        verify.verifyObject(ICustomCourseTicket, ticket)
     115        # Let's see if may_register works as expected
     116        # A, ug_ft, 100
     117        self.assertTrue(self.student['studycourse'].may_register)
     118        # O, ug_ft, 100
     119        self.student['studycourse'].current_verdict = 'O'
     120        self.assertTrue(self.student['studycourse'].may_register)
     121        # O, ug_ft, 200
     122        self.student['studycourse'].current_level = 200
     123        self.assertFalse(self.student['studycourse'].may_register)
     124        # O, de_ft, 200
     125        self.student['studycourse'].certificate.study_mode = 'de_ft'
     126        self.assertTrue(self.student['studycourse'].may_register)
     127        # O, ph_ft, 300
     128        self.student['studycourse'].certificate.study_mode = 'ph_ft'
     129        self.student['studycourse'].current_level = 300
     130        self.assertTrue(self.student['studycourse'].may_register)
     131        # O, ph_ft, 400
     132        self.student['studycourse'].current_level = 400
     133        self.assertFalse(self.student['studycourse'].may_register)
    115134
    116135    def test_manage_access(self):
Note: See TracChangeset for help on using the changeset viewer.