Changeset 14390 for main


Ignore:
Timestamp:
12 Jan 2017, 17:00:20 (8 years ago)
Author:
Henrik Bettermann
Message:

Number of number of decimal places of CGPA depends on whether it is final level or not.

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

Legend:

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

    r14387 r14390  
    6464        # The 'remark' column remains empty in base package.
    6565        remark = getattr(level_obj, 'remark', '')
     66        end_level = getattr(stud['studycourse'].certificate, 'end_level', None)
     67        if end_level and level >= end_level:
     68            cgpa = '%.2f' % (int(100*level_obj.cumulative_params[0])/100.0)
     69        else:
     70            cgpa = '%.3f' % (int(1000*level_obj.cumulative_params[0])/1000.0)
    6671        line = (
    6772                #stud.student_id,
     
    7075                level_obj.gpa_params[1],
    7176                passed_params[2],
    72                 '%.2f' % (int(100*level_obj.gpa)/100.0),
     77                '%.3f' % (int(1000*level_obj.gpa)/1000.0),
    7378                failed_courses,
    7479                passed_params[5],
    7580                level_obj.cumulative_params[1],
    7681                level_obj.cumulative_params[4],
    77                 '%.3f' % (int(1000*level_obj.cumulative_params[0])/1000.0),
     82                cgpa,
    7883                remark,
    7984                )
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_level_report.py

    r14387 r14390  
    4141        result = get_students('fac1', 'dep1', 2010, 100)
    4242        self.assertEqual(result,
    43             [(u'1234', u'Bob Tester', 90, 30, '1.66',
     43            [(u'1234', u'Bob Tester', 90, 30, '1.666',
    4444            'm_Course2_m Course3', 0, 90, 30, '1.666', '')])
    4545        return
Note: See TracChangeset for help on using the changeset viewer.