- Timestamp:
- 19 Nov 2012, 11:16:54 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9683 r9684 1286 1286 grok.require('waeup.viewStudent') 1287 1287 form_fields = grok.AutoFields(ICourseTicket) 1288 grok.template('courseticketpage') 1288 1289 pnav = 4 1289 1290 -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r9563 r9684 522 522 code = Attribute('code of the original course') 523 523 certcode = Attribute('certificate code of the study course') 524 grade = Attribute('grade calculated from score') 525 weight = Attribute('weight calculated from score') 524 526 525 527 title = schema.TextLine( … … 562 564 score = schema.Int( 563 565 title = _(u'Score'), 564 default = 0,566 default = None, 565 567 required = False, 566 568 ) … … 578 580 ) 579 581 580 581 582 def getLevel(): 582 583 """Returns the id of the level the ticket has been added to. -
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r9532 r9684 29 29 from waeup.kofa.students.vocabularies import StudyLevelSource 30 30 31 def getGradeWeightFromScore(score): 32 if score is None: 33 return (None, None) 34 if score >= 70: 35 return ('A',5) 36 if score >= 60: 37 return ('B',4) 38 if score >= 50: 39 return ('C',3) 40 if score >= 45: 41 return ('D',2) 42 if score >= 40: 43 return ('E',1) 44 return ('F',0) 45 31 46 class StudentStudyLevel(grok.Container): 32 47 """This is a container for course tickets. … … 183 198 return None 184 199 200 @property 201 def grade(self): 202 """Returns the grade calculated from score. 203 """ 204 return getGradeWeightFromScore(self.score)[0] 205 206 @property 207 def weight(self): 208 """Returns the weight calculated from score. 209 """ 210 return getGradeWeightFromScore(self.score)[1] 185 211 186 212 CourseTicket = attrs_to_fields(CourseTicket) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9641 r9684 752 752 self.browser.getLink("COURSE1").click() 753 753 self.browser.getLink("Manage").click() 754 self.browser.getControl(name="form.score").value = '10'754 #self.browser.getControl(name="form.score").value = '10' 755 755 self.browser.getControl("Save").click() 756 756 self.assertTrue('Form has been saved' in self.browser.contents) 757 # Grade and weight have been determined 758 self.browser.open(self.studycourse_path + '/100/COURSE1') 759 self.assertFalse('Grade' in self.browser.contents) 760 self.assertFalse('Weight' in self.browser.contents) 761 self.student['studycourse']['100']['COURSE1'].score = 55 762 self.browser.open(self.studycourse_path + '/100/COURSE1') 763 self.assertTrue('Grade' in self.browser.contents) 764 self.assertTrue('Weight' in self.browser.contents) 765 self.assertEqual(self.student['studycourse']['100']['COURSE1'].grade, 'C') 766 self.assertEqual(self.student['studycourse']['100']['COURSE1'].weight, 3) 757 767 # Carry-over courses will be collected when next level is created 758 768 self.browser.open(self.student_path + '/studycourse/manage') 759 769 # Add next level 770 self.student['studycourse']['100']['COURSE1'].score = 10 760 771 self.browser.getControl(name="addlevel").value = ['200'] 761 772 self.browser.getControl(name="level_session").value = ['2005'] … … 764 775 self.assertMatches( 765 776 '...: Study Level 200 (Year 2)...', self.browser.contents) 766 # COURSE1 has score 0 and thus will becomea carry-over course777 # If COURSE1 has score 10 it becomes a carry-over course 767 778 # in level 200 768 779 self.assertEqual( -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r9574 r9684 303 303 'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,' 304 304 'passmark,score,semester,title,student_id,certcode\r\n' 305 '0,0,,,,,,0,, 0,,,,\r\n'305 '0,0,,,,,,0,,,,,,\r\n' 306 306 ) 307 307 return … … 321 321 'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,' 322 322 'passmark,score,semester,title,student_id,certcode\r\n' 323 '1,1,CRS1,100,DEP1,FAC1,100,0,100, 0,2,Course 1,A111111,CERT1\r\n'323 '1,1,CRS1,100,DEP1,FAC1,100,0,100,,2,Course 1,A111111,CERT1\r\n' 324 324 ) 325 325 return … … 336 336 'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,' 337 337 'passmark,score,semester,title,student_id,certcode\r\n' 338 '1,1,CRS1,100,DEP1,FAC1,100,0,100, 0,2,Course 1,A111111,CERT1\r\n'338 '1,1,CRS1,100,DEP1,FAC1,100,0,100,,2,Course 1,A111111,CERT1\r\n' 339 339 ) 340 340 return … … 350 350 'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,' 351 351 'passmark,score,semester,title,student_id,certcode\r\n' 352 '1,1,CRS1,100,DEP1,FAC1,100,0,100, 0,2,Course 1,A111111,CERT1\r\n'352 '1,1,CRS1,100,DEP1,FAC1,100,0,100,,2,Course 1,A111111,CERT1\r\n' 353 353 ) 354 354 return
Note: See TracChangeset for help on using the changeset viewer.