Changeset 10277


Ignore:
Timestamp:
5 Jun 2013, 09:07:33 (12 years ago)
Author:
Henrik Bettermann
Message:

Use carry over tickets in next level for GPA calculation. Ignore carry over tickets in current level.

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

Legend:

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

    r10276 r10277  
    3131
    3232def find_carry_over(ticket):
    33     return None
     33    studylevel = ticket.__parent__
     34    studycourse = ticket.__parent__.__parent__
     35    levels = sorted(studycourse.keys())
     36    index = levels.index(str(studylevel.level))
     37    try:
     38        next_level = levels[index+1]
     39    except IndexError:
     40        return None
     41    next_studylevel = studycourse[next_level]
     42    co_ticket = next_studylevel.get(ticket.code, None)
     43    return co_ticket
    3444
    3545def getGradeWeightFromScore(score):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r10276 r10277  
    819819        self.assertTrue(
    820820            self.student['studycourse']['200']['COURSE1'].carry_over)
     821        return
     822
     823    def test_gpa_calculation_with_carryover(self):
     824        studylevel = createObject(u'waeup.StudentStudyLevel')
     825        studylevel.level = 100
     826        studylevel.level_session = 2005
     827        self.student['studycourse'].entry_mode = 'ug_ft'
     828        self.student['studycourse'].addStudentStudyLevel(
     829            self.certificate, studylevel)
     830        # First course has been added automatically.
     831        # Set score above passmark.
     832        studylevel['COURSE1'].score = studylevel['COURSE1'].passmark + 1
     833        # GPA is 1.
     834        self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 1.0)
     835        # Set score below passmark.
     836        studylevel['COURSE1'].score = studylevel['COURSE1'].passmark - 1
     837        # GPA is still 0.
     838        self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 0.0)
     839        studylevel2 = createObject(u'waeup.StudentStudyLevel')
     840        studylevel2.level = 200
     841        studylevel2.level_session = 2006
     842        self.student['studycourse'].addStudentStudyLevel(
     843            self.certificate, studylevel2)
     844        # Carry-over course has been autonatically added.
     845        studylevel2['COURSE1'].score = 66
     846        # The score of the carry-over course is now used for calculation of the
     847        # GPA at level 100 ...
     848        self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 4.0)
     849        # ... but not at level 200
     850        self.assertEqual(self.student['studycourse']['200'].gpa_params[0], 0.0)
    821851        return
    822852
     
    18161846            'temp_password generated: %s' % temp_password in logcontent)
    18171847
    1818     def test_transcrtipts(self):
    1819         self.student.date_of_birth = date(1981, 2, 4)
     1848    def test_transcripts(self):
    18201849        studylevel = createObject(u'waeup.StudentStudyLevel')
    18211850        studylevel.level = 100
Note: See TracChangeset for help on using the changeset viewer.