Changeset 14362 for main


Ignore:
Timestamp:
22 Dec 2016, 20:22:28 (8 years ago)
Author:
Henrik Bettermann
Message:

Customize _display_gpa.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
3 edited

Legend:

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

    r13528 r14362  
    4848        return self.is_postgrad
    4949
     50    def _display_gpa(self, gpa):
     51        return int(100 * gpa) / 100.0
     52
    5053CustomStudentStudyCourse = attrs_to_fields(CustomStudentStudyCourse)
    5154
  • main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py

    r14357 r14362  
    6060        return total
    6161
     62    def _display_gpa(self, gpa):
     63        return int(100 * gpa) / 100.0
     64
    6265    @property
    6366    def gpa_params(self):
     
    7275                credits_weighted += ticket.credits * ticket.weight
    7376        if credits_counted:
    74             level_gpa = round(credits_weighted/credits_counted, 3)
     77            level_gpa = self._display_gpa(credits_weighted/credits_counted)
    7578        # Override level_gpa if value has been imported
    7679        imported_gpa = getattr(self, 'imported_gpa', None)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r14355 r14362  
    116116        # sgpa = 82 / 23
    117117        self.assertEqual(
    118             self.student['studycourse']['100'].gpa_params[0], 3.565)
     118            self.student['studycourse']['100'].gpa_params[0], 3.56)
    119119        # imported gpa values override calculated values
    120120        studylevel.imported_gpa = 4.3
     
    388388        self.assertEqual(self.browser.headers['Content-Type'],
    389389                         'text/csv; charset=UTF-8')
    390         self.assertEqual(self.browser.contents, 'matric_number,student_id,'
    391             'level,code,level_session,ca,score\r\n234,E1000000,'
     390        self.assertEqual(self.browser.contents, 'matric_number,student_id,display_fullname,'
     391            'level,code,level_session,ca,score\r\n234,E1000000,"TESTER, Anna",'
    392392            '100,COURSE1,2003,,55\r\n')
    393393        self.browser.open(self.edit_prev_scores_url)
     
    453453        self.assertEqual(td[0][1]['level'].level_session, 2006)
    454454        self.assertEqual(td[0][1]['tickets_1'][0].code, 'ANYCODE')
    455         self.assertEqual(td[1], 3.57)
     455        self.assertEqual(td[1], 3.56)
    456456        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    457457        self.browser.open(self.student_path + '/studycourse/transcript')
Note: See TracChangeset for help on using the changeset viewer.