Changeset 10479
- Timestamp:
- 12 Aug 2013, 08:57:26 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r10276 r10479 519 519 fields = super(StudentStudyLevelProcessor, self).available_fields 520 520 fields.remove('total_credits') 521 fields.remove('gpa') 521 522 return fields 522 523 -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r10472 r10479 1478 1478 grok.template('studylevelmanagepage') 1479 1479 form_fields = grok.AutoFields(IStudentStudyLevel).omit( 1480 'validation_date', 'validated_by', 'total_credits' )1480 'validation_date', 'validated_by', 'total_credits', 'gpa') 1481 1481 pnav = 4 1482 1482 taboneactions = [_('Save'),_('Cancel')] -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r10458 r10479 578 578 ) 579 579 580 #gpa = schema.Int(581 # title = _(u'GPA'),582 #required = False,583 #readonly = True,584 #)580 gpa = schema.Int( 581 title = _(u'Unrectified GPA'), 582 required = False, 583 readonly = True, 584 ) 585 585 586 586 def addCourseTicket(ticket, course): -
main/waeup.kofa/trunk/src/waeup/kofa/students/studycourse.py
r10276 r10479 140 140 elif ticket.semester == 3: 141 141 tickets_3.append(ticket) 142 gpa_params = level_val.gpa_params 142 gpa_params = level_val.gpa_params_rectified 143 143 sgpa = gpa_params[0] 144 144 total_credits_counted += gpa_params[1] -
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r10313 r10479 100 100 101 101 @property 102 def gpa_params (self):102 def gpa_params_rectified(self): 103 103 weighted_credits = 0.0 104 104 credits_counted = 0 … … 119 119 120 120 @property 121 def gpa_params(self): 122 weighted_credits = 0.0 123 credits_counted = 0 124 level_gpa = 0.0 125 for ticket in self.values(): 126 if ticket.score: 127 credits_counted += ticket.credits 128 weighted_credits += ticket.credits * ticket.weight 129 if credits_counted: 130 level_gpa = round(weighted_credits/credits_counted, 2) 131 return level_gpa, credits_counted, weighted_credits 132 133 @property 134 def gpa(self): 135 return self.gpa_params[0] 136 137 @property 121 138 def is_current_level(self): 122 139 try: … … 165 182 166 183 StudentStudyLevel = attrs_to_fields( 167 StudentStudyLevel, omit=['total_credits' ])184 StudentStudyLevel, omit=['total_credits', 'gpa']) 168 185 169 186 class StudentStudyLevelFactory(grok.GlobalUtility): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r10472 r10479 799 799 self.browser.open(self.student_path + '/studycourse/100') 800 800 # total credits 801 self.assertEqual(self.student['studycourse']['100'].gpa_params [1], 23)801 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[1], 23) 802 802 # weigheted credits = 3 * 10 + 4 * 13 803 self.assertEqual(self.student['studycourse']['100'].gpa_params [2], 82.0)803 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[2], 82.0) 804 804 # sgpa = 82 / 23 805 self.assertEqual(self.student['studycourse']['100'].gpa_params [0], 3.57)805 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.57) 806 806 # Carry-over courses will be collected when next level is created 807 807 self.browser.open(self.student_path + '/studycourse/manage') … … 833 833 studylevel['COURSE1'].score = studylevel['COURSE1'].passmark + 1 834 834 # GPA is 1. 835 self.assertEqual(self.student['studycourse']['100'].gpa_params [0], 1.0)835 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 1.0) 836 836 # Set score below passmark. 837 837 studylevel['COURSE1'].score = studylevel['COURSE1'].passmark - 1 838 838 # GPA is still 0. 839 self.assertEqual(self.student['studycourse']['100'].gpa_params [0], 0.0)839 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 0.0) 840 840 studylevel2 = createObject(u'waeup.StudentStudyLevel') 841 841 studylevel2.level = 200 … … 847 847 # The score of the carry-over course is now used for calculation of the 848 848 # GPA at level 100 ... 849 self.assertEqual(self.student['studycourse']['100'].gpa_params [0], 4.0)849 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 4.0) 850 850 # ... but not at level 200 851 self.assertEqual(self.student['studycourse']['200'].gpa_params [0], 0.0)851 self.assertEqual(self.student['studycourse']['200'].gpa_params_rectified[0], 0.0) 852 852 return 853 853 … … 1897 1897 self.student['studycourse']['110']['COURSE2'] = courseticket 1898 1898 self.student['studycourse']['100']['COURSE1'].score = 55 1899 self.assertEqual(self.student['studycourse']['100'].gpa_params [0], 3.0)1900 self.assertEqual(self.student['studycourse']['110'].gpa_params [0], 4.0)1899 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.0) 1900 self.assertEqual(self.student['studycourse']['110'].gpa_params_rectified[0], 4.0) 1901 1901 # Get transcript data 1902 1902 td = self.student['studycourse'].getTranscriptData() -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r10458 r10479 403 403 self.assertEqual( 404 404 result, 405 ' level,level_session,level_verdict,total_credits,'405 'gpa,level,level_session,level_verdict,total_credits,' 406 406 'validated_by,validation_date,' 407 407 'student_id,number_of_tickets,certcode\r\n' 408 ' ,,0,0,,,,0,\r\n'408 '0.0,,,0,0,,,,0,\r\n' 409 409 ) 410 410 return … … 421 421 self.assertEqual( 422 422 result, 423 ' level,level_session,level_verdict,total_credits,'423 'gpa,level,level_session,level_verdict,total_credits,' 424 424 'validated_by,validation_date,' 425 425 'student_id,number_of_tickets,certcode\r\n' 426 ' 100,2012,A,100,,,A111111,1,CERT1\r\n'426 '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' 427 427 ) 428 428 return … … 437 437 self.assertEqual( 438 438 result, 439 ' level,level_session,level_verdict,total_credits,'439 'gpa,level,level_session,level_verdict,total_credits,' 440 440 'validated_by,validation_date,' 441 441 'student_id,number_of_tickets,certcode\r\n' 442 ' 100,2012,A,100,,,A111111,1,CERT1\r\n'442 '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' 443 443 ) 444 444 return … … 452 452 self.assertEqual( 453 453 result, 454 ' level,level_session,level_verdict,total_credits,'454 'gpa,level,level_session,level_verdict,total_credits,' 455 455 'validated_by,validation_date,' 456 456 'student_id,number_of_tickets,certcode\r\n' 457 ' 100,2012,A,100,,,A111111,1,CERT1\r\n'457 '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' 458 458 ) 459 459 return … … 471 471 self.assertEqual( 472 472 result, 473 ' level,level_session,level_verdict,total_credits,'473 'gpa,level,level_session,level_verdict,total_credits,' 474 474 'validated_by,validation_date,' 475 475 'student_id,number_of_tickets,certcode\r\n' 476 ' 100,2012,A,100,,,A111111,1,CERT1\r\n'476 '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' 477 477 ) 478 478 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r10449 r10479 242 242 element[2]*cm for element in tableheader], style=CONTENT_STYLE) 243 243 data.append(table) 244 sgpa = '%s: %s' % (trans('Sessional GPA ', lang), level['sgpa'])244 sgpa = '%s: %s' % (trans('Sessional GPA (rectified)', lang), level['sgpa']) 245 245 data.append(Paragraph(sgpa, style["Normal"])) 246 246 return data
Note: See TracChangeset for help on using the changeset viewer.