Changeset 10598 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 10 Sep 2013, 11:39:24 (11 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
r10586 r10598 102 102 @property 103 103 def gpa_params_rectified(self): 104 weighted_credits = 0.0 104 """Calculate corrected corrected level (sesional) gpa parameters. 105 106 The corrected gpa is displayed on transcripts only. 107 """ 108 credits_weighted = 0.0 105 109 credits_counted = 0 106 110 level_gpa = 0.0 … … 111 115 if co_ticket is not None and co_ticket.weight is not None: 112 116 credits_counted += co_ticket.credits 113 weighted_credits+= co_ticket.credits * co_ticket.weight117 credits_weighted += co_ticket.credits * co_ticket.weight 114 118 continue 115 119 credits_counted += ticket.credits 116 weighted_credits+= ticket.credits * ticket.weight120 credits_weighted += ticket.credits * ticket.weight 117 121 if credits_counted: 118 level_gpa = round( weighted_credits/credits_counted, 3)119 return level_gpa, credits_counted, weighted_credits122 level_gpa = round(credits_weighted/credits_counted, 3) 123 return level_gpa, credits_counted, credits_weighted 120 124 121 125 @property 122 126 def gpa_params(self): 123 weighted_credits = 0.0 127 """Calculate gpa parameters for this level. 128 """ 129 credits_weighted = 0.0 124 130 credits_counted = 0 125 131 level_gpa = 0.0 … … 127 133 if ticket.score is not None: 128 134 credits_counted += ticket.credits 129 weighted_credits+= ticket.credits * ticket.weight135 credits_weighted += ticket.credits * ticket.weight 130 136 if credits_counted: 131 level_gpa = round( weighted_credits/credits_counted, 3)132 return level_gpa, credits_counted, weighted_credits137 level_gpa = round(credits_weighted/credits_counted, 3) 138 return level_gpa, credits_counted, credits_weighted 133 139 134 140 @property … … 138 144 @property 139 145 def passed_params(self): 146 """Determine the number and credits of passed and failed courses. 147 148 This method is used for level reports. 149 """ 140 150 passed = failed = 0 141 151 failed_courses = [] … … 154 164 155 165 @property 166 def cumulative_params(self): 167 """Calculate the cumulative gpa and other cumulative parameters 168 for this level. 169 170 All levels below this level are taken under consideration 171 (including repeating levels). This method is used for level reports. 172 """ 173 passed_credits = 0 174 total_credits = 0 175 total_credits_counted = 0 176 total_credits_weighted = 0 177 cgpa = 0 178 for level in self.__parent__.values(): 179 if level.level > self.level: 180 continue 181 passed_credits += level.passed_params[2] 182 total_credits += level.total_credits 183 gpa_params = level.gpa_params 184 total_credits_counted += gpa_params[1] 185 total_credits_weighted += gpa_params[2] 186 if total_credits_counted: 187 cgpa = round(total_credits_weighted / total_credits_counted, 3) 188 return (cgpa, total_credits_counted, total_credits_weighted, 189 total_credits, passed_credits) 190 191 @property 156 192 def is_current_level(self): 157 193 try: -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r10586 r10598 814 814 self.assertMatches( 815 815 '...: Study Level 200 (Year 2)...', self.browser.contents) 816 # IfCOURSE1 has score 10 it becomes a carry-over course816 # Since COURSE1 has score 10 it becomes a carry-over course 817 817 # in level 200 818 818 self.assertEqual( … … 827 827 self.student['studycourse']['200'].passed_params, 828 828 (0, 0, 0, 0, [])) 829 # And also cumulative params can be calculated. Meanwhile we have the 830 # following courses: COURSE1 and COURSE2 in level 100 and 831 # COURSE1 as carry-over course in level 200. 832 self.assertEqual( 833 self.student['studycourse']['100'].cumulative_params, 834 (2.261, 23, 52.0, 23, 13)) 835 # COURSE1 in level 200 is not taken into consideration 836 # when calculating the gpa. 837 self.assertEqual( 838 self.student['studycourse']['200'].cumulative_params, 839 (2.261, 23, 52.0, 33, 13)) 829 840 return 830 841
Note: See TracChangeset for help on using the changeset viewer.