Changeset 10059


Ignore:
Timestamp:
5 Apr 2013, 08:11:29 (12 years ago)
Author:
Henrik Bettermann
Message:

Define is_previous method.

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

Legend:

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

    r9501 r10059  
    7171        return True
    7272
     73    @property
     74    def is_previous(self):
     75        if self.__name__ == 'studycourse_2':
     76            return True
     77        if self.__name__ == 'studycourse_1' and  \
     78            not self.__parent__.has_key('studycourse_2'):
     79            return True
     80        return False
     81
    7382    def addStudentStudyLevel(self, cert, studylevel):
    7483        """Add a study level object.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_student.py

    r10054 r10059  
    302302        assert results[0] is self.app['students'][self.student.student_id]
    303303
     304        # studycourse_1 is the previous course.
     305        self.assertFalse(self.student['studycourse'].is_previous)
     306        self.assertTrue(self.student['studycourse_1'].is_previous)
     307
    304308        # Students can be transferred (only) two times.
    305309        error = self.student.transfer(self.certificate,
     
    312316            [u'accommodation', u'payments', u'studycourse',
    313317             u'studycourse_1', u'studycourse_2'])
     318
     319        # The studycourse with highest order number is the previous
     320        # course.
     321        self.assertFalse(self.student['studycourse'].is_previous)
     322        self.assertFalse(self.student['studycourse_1'].is_previous)
     323        self.assertTrue(self.student['studycourse_2'].is_previous)
    314324
    315325        # The students_catalog has been updated again.
Note: See TracChangeset for help on using the changeset viewer.