Changeset 6782 for main/waeup.sirp/trunk


Ignore:
Timestamp:
16 Sep 2011, 15:18:55 (13 years ago)
Author:
Henrik Bettermann
Message:

Collect all course referrers and create respective course tickets when adding a study level.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6779 r6782  
    522522        studylevel.level = int(level_code)
    523523        try:
    524             self.context.addStudentStudyLevel(studylevel)
     524            self.context.addStudentStudyLevel(
     525                self.context.certificate,studylevel)
    525526        except KeyError:
    526527            self.flash('This level exists.')
  • main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py

    r6775 r6782  
    2323from waeup.sirp.students.interfaces import (
    2424    IStudentStudyCourse, IStudentNavigation, IStudentStudyLevel)
     25from waeup.sirp.students.studylevel import CourseTicket
    2526from waeup.sirp.utils.helpers import attrs_to_fields
    2627
     
    3839        return self.__parent__
    3940
    40     def addStudentStudyLevel(self, studylevel):
     41    def addStudentStudyLevel(self, cert, studylevel):
    4142        """Add a study level object.
    4243        """
     
    4546                'StudentStudyCourses contain only IStudentStudyLevel instances')
    4647        self[str(studylevel.level)] = studylevel
     48
     49        #Create course tickets automatically
     50        for key, val in cert.items():
     51            ticket = CourseTicket(
     52                val.getCourseCode(),
     53                val.course.title,
     54                val.level,
     55                val.core_or_elective)
     56            self[str(studylevel.level)][val.getCourseCode()] = ticket
    4757        return
    4858
  • main/waeup.sirp/trunk/src/waeup/sirp/students/studylevel.py

    r6781 r6782  
    5151            raise TypeError(
    5252                'StudentStudyLeves contain only ICourseTicket instances')
    53         self[str(courseticket.code)] = courseticket
     53        self[courseticket.code] = courseticket
    5454        return
    5555
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6779 r6782  
    283283        self.browser.getControl("Save").click()
    284284
     285        # Managers can add a any sudy level (course list)
     286        self.browser.getControl(name="addlevel").value = ['100']
     287        self.browser.getControl("Add study level").click()
     288        self.assertMatches('...<span>100</span>...',
     289                           self.browser.contents)
     290
     291        # Managers can browse all subobjects
    285292        self.browser.open(self.student_path)
    286293        self.browser.getLink("Payments").click()
    287294        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    288295        self.assertEqual(self.browser.url, self.payments_student_path)
    289 
    290296        self.browser.open(self.student_path)
    291297        self.browser.getLink("Accommodation").click()
    292298        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    293299        self.assertEqual(self.browser.url, self.accommodation_student_path)
    294 
    295300        self.browser.open(self.student_path)
    296301        self.browser.getLink("History").click()
Note: See TracChangeset for help on using the changeset viewer.