Changeset 10479


Ignore:
Timestamp:
12 Aug 2013, 08:57:26 (11 years ago)
Author:
Henrik Bettermann
Message:

Reinvent temporary/unrectified/momentary/sessional gpa as a property attribute of study levels. The sessional gpa shown on transcript slips is now called 'rectified sessional gpa'.

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

Legend:

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

    r10276 r10479  
    519519        fields = super(StudentStudyLevelProcessor, self).available_fields
    520520        fields.remove('total_credits')
     521        fields.remove('gpa')
    521522        return  fields
    522523
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r10472 r10479  
    14781478    grok.template('studylevelmanagepage')
    14791479    form_fields = grok.AutoFields(IStudentStudyLevel).omit(
    1480         'validation_date', 'validated_by', 'total_credits')
     1480        'validation_date', 'validated_by', 'total_credits', 'gpa')
    14811481    pnav = 4
    14821482    taboneactions = [_('Save'),_('Cancel')]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r10458 r10479  
    578578        )
    579579
    580     #gpa = schema.Int(
    581     #    title = _(u'GPA'),
    582     #    required = False,
    583     #    readonly = True,
    584     #    )
     580    gpa = schema.Int(
     581        title = _(u'Unrectified GPA'),
     582        required = False,
     583        readonly = True,
     584        )
    585585
    586586    def addCourseTicket(ticket, course):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studycourse.py

    r10276 r10479  
    140140                elif ticket.semester == 3:
    141141                    tickets_3.append(ticket)
    142             gpa_params = level_val.gpa_params
     142            gpa_params = level_val.gpa_params_rectified
    143143            sgpa = gpa_params[0]
    144144            total_credits_counted += gpa_params[1]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r10313 r10479  
    100100
    101101    @property
    102     def gpa_params(self):
     102    def gpa_params_rectified(self):
    103103        weighted_credits = 0.0
    104104        credits_counted = 0
     
    119119
    120120    @property
     121    def gpa_params(self):
     122        weighted_credits = 0.0
     123        credits_counted = 0
     124        level_gpa = 0.0
     125        for ticket in self.values():
     126            if ticket.score:
     127                credits_counted += ticket.credits
     128                weighted_credits += ticket.credits * ticket.weight
     129        if credits_counted:
     130            level_gpa = round(weighted_credits/credits_counted, 2)
     131        return level_gpa, credits_counted, weighted_credits
     132
     133    @property
     134    def gpa(self):
     135        return self.gpa_params[0]
     136
     137    @property
    121138    def is_current_level(self):
    122139        try:
     
    165182
    166183StudentStudyLevel = attrs_to_fields(
    167     StudentStudyLevel, omit=['total_credits'])
     184    StudentStudyLevel, omit=['total_credits', 'gpa'])
    168185
    169186class StudentStudyLevelFactory(grok.GlobalUtility):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r10472 r10479  
    799799        self.browser.open(self.student_path + '/studycourse/100')
    800800        # total credits
    801         self.assertEqual(self.student['studycourse']['100'].gpa_params[1], 23)
     801        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[1], 23)
    802802        # weigheted credits = 3 * 10 + 4 * 13
    803         self.assertEqual(self.student['studycourse']['100'].gpa_params[2], 82.0)
     803        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[2], 82.0)
    804804        # sgpa = 82 / 23
    805         self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 3.57)
     805        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.57)
    806806        # Carry-over courses will be collected when next level is created
    807807        self.browser.open(self.student_path + '/studycourse/manage')
     
    833833        studylevel['COURSE1'].score = studylevel['COURSE1'].passmark + 1
    834834        # GPA is 1.
    835         self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 1.0)
     835        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 1.0)
    836836        # Set score below passmark.
    837837        studylevel['COURSE1'].score = studylevel['COURSE1'].passmark - 1
    838838        # GPA is still 0.
    839         self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 0.0)
     839        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 0.0)
    840840        studylevel2 = createObject(u'waeup.StudentStudyLevel')
    841841        studylevel2.level = 200
     
    847847        # The score of the carry-over course is now used for calculation of the
    848848        # GPA at level 100 ...
    849         self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 4.0)
     849        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 4.0)
    850850        # ... but not at level 200
    851         self.assertEqual(self.student['studycourse']['200'].gpa_params[0], 0.0)
     851        self.assertEqual(self.student['studycourse']['200'].gpa_params_rectified[0], 0.0)
    852852        return
    853853
     
    18971897        self.student['studycourse']['110']['COURSE2'] = courseticket
    18981898        self.student['studycourse']['100']['COURSE1'].score = 55
    1899         self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 3.0)
    1900         self.assertEqual(self.student['studycourse']['110'].gpa_params[0], 4.0)
     1899        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.0)
     1900        self.assertEqual(self.student['studycourse']['110'].gpa_params_rectified[0], 4.0)
    19011901        # Get transcript data
    19021902        td = self.student['studycourse'].getTranscriptData()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r10458 r10479  
    403403        self.assertEqual(
    404404            result,
    405             'level,level_session,level_verdict,total_credits,'
     405            'gpa,level,level_session,level_verdict,total_credits,'
    406406            'validated_by,validation_date,'
    407407            'student_id,number_of_tickets,certcode\r\n'
    408             ',,0,0,,,,0,\r\n'
     408            '0.0,,,0,0,,,,0,\r\n'
    409409            )
    410410        return
     
    421421        self.assertEqual(
    422422            result,
    423             'level,level_session,level_verdict,total_credits,'
     423            'gpa,level,level_session,level_verdict,total_credits,'
    424424            'validated_by,validation_date,'
    425425            'student_id,number_of_tickets,certcode\r\n'
    426             '100,2012,A,100,,,A111111,1,CERT1\r\n'
     426            '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'
    427427            )
    428428        return
     
    437437        self.assertEqual(
    438438            result,
    439             'level,level_session,level_verdict,total_credits,'
     439            'gpa,level,level_session,level_verdict,total_credits,'
    440440            'validated_by,validation_date,'
    441441            'student_id,number_of_tickets,certcode\r\n'
    442             '100,2012,A,100,,,A111111,1,CERT1\r\n'
     442            '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'
    443443            )
    444444        return
     
    452452        self.assertEqual(
    453453            result,
    454             'level,level_session,level_verdict,total_credits,'
     454            'gpa,level,level_session,level_verdict,total_credits,'
    455455            'validated_by,validation_date,'
    456456            'student_id,number_of_tickets,certcode\r\n'
    457             '100,2012,A,100,,,A111111,1,CERT1\r\n'
     457            '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'
    458458            )
    459459        return
     
    471471        self.assertEqual(
    472472            result,
    473             'level,level_session,level_verdict,total_credits,'
     473            'gpa,level,level_session,level_verdict,total_credits,'
    474474            'validated_by,validation_date,'
    475475            'student_id,number_of_tickets,certcode\r\n'
    476             '100,2012,A,100,,,A111111,1,CERT1\r\n'
     476            '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'
    477477            )
    478478        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r10449 r10479  
    242242            element[2]*cm for element in tableheader], style=CONTENT_STYLE)
    243243        data.append(table)
    244         sgpa = '%s: %s' % (trans('Sessional GPA', lang), level['sgpa'])
     244        sgpa = '%s: %s' % (trans('Sessional GPA (rectified)', lang), level['sgpa'])
    245245        data.append(Paragraph(sgpa, style["Normal"]))
    246246    return data
Note: See TracChangeset for help on using the changeset viewer.