Ignore:
Timestamp:
10 Jan 2017, 18:33:30 (8 years ago)
Author:
Henrik Bettermann
Message:

Exchange level and session on report slips.

Use sting formatting for displaying GPA values.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/transcript.pt

    r11551 r14382  
    2121      </td>
    2222      <td>
    23         <div tal:content="python:tdata[1]">GPA</div>
     23        <div tal:content="python:'%.3f' % tdata[1]">GPA</div>
    2424      </td>
    2525    </tr>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/level_report.py

    r14373 r14382  
    7171                passed_params[2],
    7272                passed_params[5],
    73                 level_obj.gpa,
     73                '%.2f' % (int(100*level_obj.gpa)/100.0),
    7474                failed_courses,
    7575                level_obj.cumulative_params[1],
    7676                level_obj.cumulative_params[4],
    77                 level_obj.cumulative_params[0],
     77                '%.3f' % (int(1000*level_obj.cumulative_params[0])/1000.0),
    7878                remark,
    7979                )
     
    115115            'S/N',
    116116            'Matric No.',
    117             'Name',
     117            translate(_('Student Name')),
    118118            TTR(translate(_('Total Credits Taken'))),
    119119            TTR(translate(_('Total Credits Passed'))),
     
    197197        pdf_data += [Paragraph(
    198198                    translate(
    199                         '${a}<br />${b}<br />Level: ${c}<br />Session: ${d}',
     199                        '${a}<br />${b}<br />Session: ${c}<br />Level: ${d}',
    200200                        mapping = {'a':self.factitle,
    201201                                   'b':self.deptitle,
    202                                    'c':self.level,
    203                                    'd':self.session, }),
     202                                   'c':self.session,
     203                                   'd':self.level,
     204                                   }),
    204205                    STYLE["Normal"]),
    205206                    Spacer(1, 12),]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/session_results_presentation.py

    r14373 r14382  
    150150                              STYLE["Normal"]),
    151151                    Spacer(1, 12),]
    152         pdf_data += [Paragraph('%s<br />%s<br />Level: %s<br />Session: %s' % (
    153                     self.factitle, self.deptitle, self.level, self.session),
     152        pdf_data += [Paragraph('%s<br />%s<br />Session: %s<br />Level: %s' % (
     153                    self.factitle, self.deptitle, self.session, self.level),
    154154                    STYLE["Normal"]),
    155155                    Spacer(1, 12),]
     
    175175        pdf_data += [Paragraph('<strong>Summary</strong>', STYLE["Normal"])]
    176176        pdf_data.append(Spacer(1, 10))
     177        total_count = 0
    177178        for gpa_class in range(len(students_utils.gpa_boundaries)-1,-1,-1):
    178179            gpa_class_name = students_utils.gpa_boundaries[gpa_class][1]
    179180            gpa_count = len(self.data[gpa_class])
     181            total_count += gpa_count
    180182            pdf_data += [Paragraph('%s: %s'
    181183                         % (gpa_class_name, gpa_count), STYLE["Normal"])]
    182184            pass
     185        pdf_data += [Paragraph('Total: %s' % (total_count), STYLE["Normal"])]
    183186
    184187        doc_title = translate(_('Presentation of Session Results'))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_level_report.py

    r14373 r14382  
    4141        result = get_students('fac1', 'dep1', 2010, 100)
    4242        self.assertEqual(result,
    43             [(u'1234', u'Bob Tester', 90, 30, 0, 1.667, 'm_Course2_m Course3',
    44               90, 30, 1.667, '')])
     43            [(u'1234', u'Bob Tester', 90, 30, 0, '1.66',
     44            'm_Course2_m Course3', 90, 30, '1.666', '')])
    4545        return
    4646
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studycourse.py

    r14361 r14382  
    120120        return
    121121
    122     def _display_gpa(self, gpa):
    123         return round(gpa, 2)
    124 
    125122    def getTranscriptData(self):
    126123        """Get a sorted list of dicts with level and course ticket data.
     
    155152                     sgpa=sgpa))
    156153        if total_credits_counted:
    157             cgpa = self._display_gpa(cgpa/total_credits_counted)
     154            cgpa = cgpa/total_credits_counted
    158155        # Override cgpa if value has been imported
    159156        # (not implemented in base package)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r14368 r14382  
    108108        return session_string
    109109
    110     def _display_gpa(self, gpa):
    111         return round(gpa, 3)
    112 
    113110    @property
    114111    def gpa_params_rectified(self):
     
    130127                credits_weighted += ticket.credits * ticket.weight
    131128        if credits_counted:
    132             level_gpa = self._display_gpa(credits_weighted/credits_counted)
     129            level_gpa = credits_weighted/credits_counted
    133130        return level_gpa, credits_counted, credits_weighted
    134131
     
    145142                credits_weighted += ticket.credits * ticket.weight
    146143        if credits_counted:
    147             level_gpa = self._display_gpa(credits_weighted/credits_counted)
     144            level_gpa = credits_weighted/credits_counted
    148145        # Override level_gpa if value has been imported
    149146        # (not implemented in base package)
     
    210207                total_credits_weighted += gpa_params[2]
    211208            if total_credits_counted:
    212                 cgpa = self._display_gpa(total_credits_weighted/total_credits_counted)
     209                cgpa = total_credits_weighted/total_credits_counted
    213210            # Override cgpa if value has been imported
    214211            # (not implemented in base package)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r14368 r14382  
    874874        # sgpa = 82 / 23
    875875        self.assertEqual(
    876             self.student['studycourse']['100'].gpa_params_rectified[0], 3.565)
     876            self.student['studycourse']['100'].gpa_params_rectified[0],
     877            3.5652173913043477)
    877878        # Carry-over courses will be collected when next level is created
    878879        self.browser.open(self.student_path + '/studycourse/manage')
     
    903904        self.assertEqual(
    904905            self.student['studycourse']['100'].cumulative_params,
    905             (2.261, 23, 52.0, 23, 13))
     906            (2.260869565217391, 23, 52.0, 23, 13))
    906907        # COURSE1 in level 200 is not taken into consideration
    907908        # when calculating the gpa.
    908909        self.assertEqual(
    909910            self.student['studycourse']['200'].cumulative_params,
    910             (2.261, 23, 52.0, 33, 13))
     911            (2.260869565217391, 23, 52.0, 33, 13))
    911912        return
    912913
     
    21032104        self.assertEqual(td[0][1]['level'].level_session, 2006)
    21042105        self.assertEqual(td[0][1]['tickets_1'][0].code, 'ANYCODE')
    2105         self.assertEqual(td[1], 3.57)
     2106        self.assertEqual(td[1], 3.5652173913043477)
    21062107        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    21072108        self.browser.open(self.student_path + '/studycourse/transcript')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r14319 r14382  
    282282            element[2]*cm for element in tableheader], style=CONTENT_STYLE)
    283283        data.append(table)
    284         sgpa = '%s: %s' % (trans('Sessional GPA (rectified)', lang), level['sgpa'])
     284        sgpa = '%s: %.2f' % (trans('Sessional GPA (rectified)', lang), level['sgpa'])
    285285        data.append(Paragraph(sgpa, style["Normal"]))
    286286    return data
     
    882882        transcript_data = view.context.getTranscriptData()
    883883        levels_data = transcript_data[0]
    884         gpa = transcript_data[1]
    885884
    886885        contextdata = []
     
    921920        f_label = trans(_('Cumulative GPA:'), portal_language)
    922921        f_label = Paragraph(f_label, ENTRY1_STYLE)
    923         f_text = formatted_text('%s (%s)' % (gpa, self.getClassFromCGPA(gpa)[1]))
     922        f_text = formatted_text('%.3f (%s)' % (
     923            transcript_data[1], self.getClassFromCGPA(transcript_data[1])[1]))
    924924        f_text = Paragraph(f_text, ENTRY1_STYLE)
    925925        contextdata.append([f_label,f_text])
Note: See TracChangeset for help on using the changeset viewer.