Ignore:
Timestamp:
9 Jul 2020, 07:23:40 (4 years ago)
Author:
Henrik Bettermann
Message:

DSPG requires total credits on semester basis.

Location:
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py

    r15774 r16155  
    4242    NigeriaExportPDFClearanceSlip,
    4343    NigeriaAccommodationManageFormPage,
     44    NigeriaAccommodationDisplayFormPage,
    4445    NigeriaBedTicketAddPage,
    4546    )
     
    172173        return pdfstream
    173174
     175class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage):
     176    """ Page to view bed tickets.
     177    """
     178    with_hostel_selection = True
     179
    174180class CustomAccommodationManageFormPage(NigeriaAccommodationManageFormPage):
    175181    """ Page to manage bed tickets.
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_browser.py

    r15743 r16155  
    7474        open(path, 'wb').write(self.browser.contents)
    7575        print "Sample PDF admission_slip.pdf written to %s" % path
     76
     77    def test_student_course_registration(self):
     78        IWorkflowState(self.student).setState('school fee paid')
     79        self.student['studycourse'].current_level = 200
     80        self.browser.open(self.login_path)
     81        self.browser.getControl(name="form.login").value = self.student_id
     82        self.browser.getControl(name="form.password").value = 'spwd'
     83        self.browser.getControl("Login").click()
     84        self.browser.open(self.student_path + '/studycourse/add')
     85        self.browser.getControl("Create course list now").click()
     86        # A level with one course ticket was created
     87        self.assertEqual(self.student['studycourse']['200'].number_of_tickets, 0)
     88        self.browser.getLink("200").click()
     89        self.browser.getLink("Edit course list").click()
     90        self.browser.getLink("here").click()
     91        self.browser.getControl(name="form.course").value = ['COURSE1']
     92        self.course.credits = 41
     93        self.browser.getControl("Add course ticket").click()
     94        self.assertTrue(
     95            'Maximum credits (40) in 1st semester exceeded.' in self.browser.contents)
     96        self.course.credits = 39
     97        self.browser.getControl("Add course ticket").click()
     98        self.assertTrue(
     99            'Successfully added COURSE1.' in self.browser.contents)
     100        return
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py

    r16044 r16155  
    278278
    279279    def warnCreditsOOR(self, studylevel, course=None):
    280         """Return message if credits are out of range. In the base
    281         package only maximum credits is set.
    282         """
    283         if course and studylevel.total_credits + course.credits > 80:
    284             return _('Maximum credits exceeded.')
    285         elif studylevel.total_credits > 80:
    286             return _('Maximum credits exceeded.')
     280        """DSPG requires total credits on semester
     281        basis.
     282        """
     283        total = [0, 0, 0]
     284        for ticket in studylevel.values():
     285            if ticket.outstanding:
     286                continue
     287            if not ticket.semester in (1, 2):
     288                total[ticket.semester] += ticket.credits
     289            else:
     290                total[0] += ticket.credits
     291        if course:
     292            if course.semester == 1 and total[1] + course.credits > 40:
     293                return _('Maximum credits (40) in 1st semester exceeded.')
     294            if course.semester == 2 and total[2] + course.credits > 40:
     295                return _('Maximum credits (40) in 2nd semester exceeded.')
     296        else:
     297            if total[1] > 40:
     298                return _('Maximum credits (40) in 1st semester exceeded.')
     299            if total[2] > 40:
     300                return _('Maximum credits (40) in 2nd semester exceeded.')
    287301        return
    288302
Note: See TracChangeset for help on using the changeset viewer.