Changeset 9812 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 20 Dec 2012, 06:59:26 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r9698 r9812 82 82 @property 83 83 def gpa(self): 84 gpa = 0 84 gpa = 0.0 85 85 credits_counted = 0 86 86 for ticket in self.values(): … … 89 89 gpa += ticket.credits * ticket.weight 90 90 if credits_counted: 91 gpa = 100*gpa/credits_counted92 return float(gpa)/10091 gpa = round(gpa/credits_counted, 2) 92 return gpa 93 93 94 94 @property -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9795 r9812 764 764 self.browser.getLink("COURSE1").click() 765 765 self.browser.getLink("Manage").click() 766 #self.browser.getControl(name="form.score").value = '10'767 766 self.browser.getControl("Save").click() 768 767 self.assertTrue('Form has been saved' in self.browser.contents) … … 777 776 self.assertEqual(self.student['studycourse']['100']['COURSE1'].grade, 'C') 778 777 self.assertEqual(self.student['studycourse']['100']['COURSE1'].weight, 3) 779 # GPA has been properly calculated and is shown on the page 778 # We add another ticket to check if GPA will be correctly calculated 779 # (and rounded) 780 courseticket = createObject('waeup.CourseTicket') 781 courseticket.code = 'ANYCODE' 782 courseticket.title = u'Any TITLE' 783 courseticket.credits = 13 784 courseticket.score = 66 785 courseticket.semester = 1 786 courseticket.dcode = u'ANYDCODE' 787 courseticket.fcode = u'ANYFCODE' 788 self.student['studycourse']['100']['COURSE2'] = courseticket 780 789 self.browser.open(self.student_path + '/studycourse/100') 781 self.assertTrue(' 3.0' in self.browser.contents)782 self.assertEqual(self.student['studycourse']['100'].gpa, 3. 0)790 self.assertTrue('<div>3.57</div>' in self.browser.contents) 791 self.assertEqual(self.student['studycourse']['100'].gpa, 3.57) 783 792 # Carry-over courses will be collected when next level is created 784 793 self.browser.open(self.student_path + '/studycourse/manage')
Note: See TracChangeset for help on using the changeset viewer.