Changeset 10553


Ignore:
Timestamp:
29 Aug 2013, 05:24:10 (11 years ago)
Author:
Henrik Bettermann
Message:

Derive information about passed and failed course.

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

Legend:

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

    r10479 r10553  
    546546    certcode = Attribute('The certificate code of the study course')
    547547    is_current_level = Attribute('Is this level the current level of the student?')
     548    passed_params = Attribute('Information about passed and failed courses')
    548549
    549550    level_session = schema.Choice(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/level_report.py

    r10552 r10553  
    5454        if level_obj.level_session != session:
    5555            continue
     56        passed_params = level_obj.passed_params
    5657        line = (stud.student_id,
    5758                stud.matric_number,
    5859                stud.display_fullname,
    5960                level_obj.total_credits,
    60                 level_obj.gpa)
     61                passed_params[2],
     62                level_obj.gpa,
     63                passed_params[4],
     64                )
    6165        table.append(line)
    6266    return table
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_level_report.py

    r10552 r10553  
    1919        result = get_students_by('fac1', 'dep1', 2010, 100)
    2020        self.assertEqual(result,
    21             [(u'K1000000', u'1234', u'Bob Tester', 30, 5.0)])
     21            [(u'K1000000', u'1234', u'Bob Tester', 30, 30, 5.0, [])])
    2222        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r10539 r10553  
    137137
    138138    @property
     139    def passed_params(self):
     140        passed = failed = 0
     141        failed_courses = []
     142        failed_credits = 0
     143        passed_credits = 0
     144        for ticket in self.values():
     145            if ticket.score is not None:
     146                if ticket.score < ticket.passmark:
     147                    failed += 1
     148                    failed_credits += ticket.credits
     149                    failed_courses.append(ticket.code)
     150                else:
     151                    passed += 1
     152                    passed_credits += ticket.credits
     153        return passed, failed, passed_credits, failed_credits, failed_courses
     154
     155    @property
    139156    def is_current_level(self):
    140157        try:
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r10539 r10553  
    786786        self.assertEqual(self.student['studycourse']['100']['COURSE1'].grade, 'C')
    787787        self.assertEqual(self.student['studycourse']['100']['COURSE1'].weight, 3)
    788         # We add another ticket to check if GPAwill be correctly calculated
     788        # We add another ticket to check if GPA will be correctly calculated
    789789        # (and rounded)
    790790        courseticket = createObject('waeup.CourseTicket')
     
    820820        self.assertTrue(
    821821            self.student['studycourse']['200']['COURSE1'].carry_over)
     822        # Passed and failed courses have been counted
     823        self.assertEqual(
     824            self.student['studycourse']['100'].passed_params,
     825            (1, 1, 13, 10, ['COURSE1']))
     826        self.assertEqual(
     827            self.student['studycourse']['200'].passed_params,
     828            (0, 0, 0, 0, []))
    822829        return
    823830
Note: See TracChangeset for help on using the changeset viewer.