Ignore:
Timestamp:
2 Sep 2013, 06:42:16 (11 years ago)
Author:
Henrik Bettermann
Message:

Add browser components.

File:
1 edited

Legend:

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

    r10479 r10576  
    663663        return pdf_stream
    664664
     665    gpa_boundaries = (1, 1.5, 2.4, 3.5, 4.5, 5)
     666
    665667    def getClassFromCGPA(self, gpa):
    666         if gpa < 1:
    667             return 'Fail'
    668         if gpa < 1.5:
    669             return 'Pass'
    670         if gpa < 2.4:
    671             return '3rd Class'
    672         if gpa < 3.5:
    673             return '2nd Class Lower'
    674         if gpa < 4.5:
    675             return '2nd Class Upper'
    676         if gpa <= 5:
    677             return '1st Class'
    678         return 'N/A'
     668        if gpa < self.gpa_boundaries[0]:
     669            return 0, 'Fail'
     670        if gpa < self.gpa_boundaries[1]:
     671            return 1, 'Pass'
     672        if gpa < self.gpa_boundaries[2]:
     673            return 2, '3rd Class'
     674        if gpa < self.gpa_boundaries[3]:
     675            return 3, '2nd Class Lower'
     676        if gpa < self.gpa_boundaries[4]:
     677            return 4, '2nd Class Upper'
     678        if gpa <= self.gpa_boundaries[5]:
     679            return 5, '1st Class'
     680        return 999, 'N/A'
    679681
    680682    def renderPDFTranscript(self, view, filename='transcript.pdf',
     
    754756        f_label = trans(_('Cumulative GPA:'), portal_language)
    755757        f_label = Paragraph(f_label, ENTRY1_STYLE)
    756         f_text = formatted_text('%s (%s)' % (gpa, self.getClassFromCGPA(gpa)))
     758        f_text = formatted_text('%s (%s)' % (gpa, self.getClassFromCGPA(gpa)[1]))
    757759        f_text = Paragraph(f_text, ENTRY1_STYLE)
    758760        contextdata.append([f_label,f_text])
Note: See TracChangeset for help on using the changeset viewer.