Changeset 10276
- Timestamp:
- 5 Jun 2013, 08:02:29 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r10028 r10276 519 519 fields = super(StudentStudyLevelProcessor, self).available_fields 520 520 fields.remove('total_credits') 521 fields.remove('gpa')522 521 return fields 523 522 -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r10270 r10276 1337 1337 grok.template('studylevelmanagepage') 1338 1338 form_fields = grok.AutoFields(IStudentStudyLevel).omit( 1339 'validation_date', 'validated_by', 'total_credits' , 'gpa')1339 'validation_date', 'validated_by', 'total_credits') 1340 1340 pnav = 4 1341 1341 taboneactions = [_('Save'),_('Cancel')] -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r10250 r10276 567 567 ) 568 568 569 gpa = schema.Int(570 title = _(u'GPA'),571 required = False,572 readonly = True,573 )569 #gpa = schema.Int( 570 # title = _(u'GPA'), 571 # required = False, 572 # readonly = True, 573 # ) 574 574 575 575 def addCourseTicket(ticket, course): -
main/waeup.kofa/trunk/src/waeup/kofa/students/studycourse.py
r10260 r10276 133 133 tickets_3 = [] 134 134 tickets = sorted(level_val.values(), key=lambda ticket: ticket.code) 135 sgpa = 0.0136 session_credits_counted = 0137 135 for ticket in tickets: 138 136 if ticket.semester == 1: … … 142 140 elif ticket.semester == 3: 143 141 tickets_3.append(ticket) 144 if ticket.score: 145 total_credits_counted += ticket.credits 146 session_credits_counted += ticket.credits 147 cgpa += ticket.credits * ticket.weight 148 sgpa += ticket.credits * ticket.weight 149 if session_credits_counted: 150 sgpa = round(sgpa/session_credits_counted, 2) 142 gpa_params = level_val.gpa_params 143 sgpa = gpa_params[0] 144 total_credits_counted += gpa_params[1] 145 cgpa += gpa_params[2] 151 146 levels.append( 152 147 dict(level_key=level_key, -
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r9925 r10276 29 29 from waeup.kofa.utils.helpers import attrs_to_fields 30 30 from waeup.kofa.students.vocabularies import StudyLevelSource 31 32 def find_carry_over(ticket): 33 return None 31 34 32 35 def getGradeWeightFromScore(score): … … 87 90 88 91 @property 89 def gpa (self):90 gpa= 0.092 def gpa_params(self): 93 weighted_credits = 0.0 91 94 credits_counted = 0 95 level_gpa = 0.0 92 96 for ticket in self.values(): 93 if ticket.score: 97 if ticket.carry_over is False and ticket.score: 98 if ticket.score < ticket.passmark: 99 co_ticket = find_carry_over(ticket) 100 if co_ticket is not None: 101 credits_counted += co_ticket.credits 102 weighted_credits += co_ticket.credits * co_ticket.weight 103 continue 94 104 credits_counted += ticket.credits 95 gpa+= ticket.credits * ticket.weight105 weighted_credits += ticket.credits * ticket.weight 96 106 if credits_counted: 97 gpa = round(gpa/credits_counted, 2)98 return gpa107 level_gpa = round(weighted_credits/credits_counted, 2) 108 return level_gpa, credits_counted, weighted_credits 99 109 100 110 @property … … 145 155 146 156 StudentStudyLevel = attrs_to_fields( 147 StudentStudyLevel, omit=['total_credits' , 'gpa'])157 StudentStudyLevel, omit=['total_credits']) 148 158 149 159 class StudentStudyLevelFactory(grok.GlobalUtility): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r10267 r10276 785 785 self.assertEqual(self.student['studycourse']['100']['COURSE1'].grade, 'C') 786 786 self.assertEqual(self.student['studycourse']['100']['COURSE1'].weight, 3) 787 # We add another ticket to check if GPA 787 # We add another ticket to check if GPAwill be correctly calculated 788 788 # (and rounded) 789 789 courseticket = createObject('waeup.CourseTicket') … … 797 797 self.student['studycourse']['100']['COURSE2'] = courseticket 798 798 self.browser.open(self.student_path + '/studycourse/100') 799 self.assertTrue('<div>3.57</div>' in self.browser.contents) 800 self.assertEqual(self.student['studycourse']['100'].gpa, 3.57) 799 # total credits 800 self.assertEqual(self.student['studycourse']['100'].gpa_params[1], 23) 801 # weigheted credits = 3 * 10 + 4 * 13 802 self.assertEqual(self.student['studycourse']['100'].gpa_params[2], 82.0) 803 # sgpa = 82 / 23 804 self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 3.57) 801 805 # Carry-over courses will be collected when next level is created 802 806 self.browser.open(self.student_path + '/studycourse/manage') … … 1836 1840 self.student['studycourse']['110']['COURSE2'] = courseticket 1837 1841 self.student['studycourse']['100']['COURSE1'].score = 55 1838 self.assertEqual(self.student['studycourse']['100'].gpa , 3.0)1839 self.assertEqual(self.student['studycourse']['110'].gpa , 4.0)1842 self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 3.0) 1843 self.assertEqual(self.student['studycourse']['110'].gpa_params[0], 4.0) 1840 1844 # Get transcript data 1841 1845 td = self.student['studycourse'].getTranscriptData() -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r10245 r10276 402 402 self.assertEqual( 403 403 result, 404 ' gpa,level,level_session,level_verdict,total_credits,'404 'level,level_session,level_verdict,total_credits,' 405 405 'validated_by,validation_date,' 406 406 'student_id,number_of_tickets,certcode\r\n' 407 ' 0.0,,,0,0,,,,0,\r\n'407 ',,0,0,,,,0,\r\n' 408 408 ) 409 409 return … … 420 420 self.assertEqual( 421 421 result, 422 ' gpa,level,level_session,level_verdict,total_credits,'422 'level,level_session,level_verdict,total_credits,' 423 423 'validated_by,validation_date,' 424 424 'student_id,number_of_tickets,certcode\r\n' 425 ' 0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'425 '100,2012,A,100,,,A111111,1,CERT1\r\n' 426 426 ) 427 427 return … … 436 436 self.assertEqual( 437 437 result, 438 ' gpa,level,level_session,level_verdict,total_credits,'438 'level,level_session,level_verdict,total_credits,' 439 439 'validated_by,validation_date,' 440 440 'student_id,number_of_tickets,certcode\r\n' 441 ' 0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'441 '100,2012,A,100,,,A111111,1,CERT1\r\n' 442 442 ) 443 443 return … … 451 451 self.assertEqual( 452 452 result, 453 ' gpa,level,level_session,level_verdict,total_credits,'453 'level,level_session,level_verdict,total_credits,' 454 454 'validated_by,validation_date,' 455 455 'student_id,number_of_tickets,certcode\r\n' 456 ' 0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'456 '100,2012,A,100,,,A111111,1,CERT1\r\n' 457 457 ) 458 458 return … … 470 470 self.assertEqual( 471 471 result, 472 ' gpa,level,level_session,level_verdict,total_credits,'472 'level,level_session,level_verdict,total_credits,' 473 473 'validated_by,validation_date,' 474 474 'student_id,number_of_tickets,certcode\r\n' 475 ' 0.0,100,2012,A,100,,,A111111,1,CERT1\r\n'475 '100,2012,A,100,,,A111111,1,CERT1\r\n' 476 476 ) 477 477 return
Note: See TracChangeset for help on using the changeset viewer.