Changeset 9687 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 19 Nov 2012, 18:08:39 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9685 r9687 1037 1037 'b':level_title}) 1038 1038 1039 @property1040 def total_credits(self):1041 total_credits = 01042 for key, val in self.context.items():1043 total_credits += val.credits1044 return total_credits1045 1046 1039 class ExportPDFCourseRegistrationSlipPage(UtilityView, grok.View): 1047 1040 """Deliver a PDF slip of the context. … … 2213 2206 2214 2207 @property 2215 def total_credits(self):2216 total_credits = 02217 for key, val in self.context.items():2218 total_credits += val.credits2219 return total_credits2220 2221 @property2222 2208 def translated_values(self): 2223 2209 return translated_values(self) … … 2263 2249 self.redirect(self.url(self.context)) 2264 2250 return 2265 if self. total_credits > self.max_credits:2251 if self.context.total_credits > self.max_credits: 2266 2252 self.flash(_('Maximum credits of ${a} exceeded.', 2267 2253 mapping = {'a':self.max_credits})) -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studyleveleditpage.pt
r8921 r9687 5 5 Course Tickets 6 6 (Total Credits: 7 <span i18n:name="total_credits" tal:replace="view/total_credits">TOTAL</span>) 7 <span i18n:name="total_credits" 8 tal:replace="view/context/total_credits">TOTAL</span>) 8 9 </h3> 9 10 <table class="display dataTableManage"> -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studylevelpage.pt
r9320 r9687 20 20 </td> 21 21 <td> 22 <span tal:replace="view/total_credits">TOTAL</span> 22 <span tal:replace="view/context/total_credits">26</span> 23 </td> 24 </tr> 25 <tr> 26 <td i18n:translate=""> 27 Momentary GPA: 28 </td> 29 <td> 30 <span tal:replace="python: '%4.2f' % view.context.gpa">2.33</span> 23 31 </td> 24 32 </tr> -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r9684 r9687 481 481 is_current_level = Attribute('Is this level the current level of the student?') 482 482 total_credits = Attribute('Total of all ticket credits in this study level.') 483 gpa = Attribute('Grade point average in this study level.') 483 484 484 485 level_session = schema.Choice( -
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r9684 r9687 81 81 82 82 @property 83 def gpa(self): 84 gpa = 0 85 credits_counted = 0 86 for ticket in self.values(): 87 if ticket.score: 88 credits_counted += ticket.credits 89 gpa += ticket.credits * ticket.weight 90 if credits_counted: 91 gpa = float(gpa)/credits_counted 92 return gpa 93 94 @property 83 95 def is_current_level(self): 84 96 try: -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9684 r9687 765 765 self.assertEqual(self.student['studycourse']['100']['COURSE1'].grade, 'C') 766 766 self.assertEqual(self.student['studycourse']['100']['COURSE1'].weight, 3) 767 # GPA has been properly calculated and is shown on the page 768 self.browser.open(self.student_path + '/studycourse/100') 769 self.assertTrue('3.00' in self.browser.contents) 770 self.assertEqual(self.student['studycourse']['100'].gpa, 3.0) 767 771 # Carry-over courses will be collected when next level is created 768 772 self.browser.open(self.student_path + '/studycourse/manage')
Note: See TracChangeset for help on using the changeset viewer.