Changeset 7661 for main/waeup.sirp/trunk/src
- Timestamp:
- 17 Feb 2012, 07:43:22 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r7641 r7661 378 378 ) 379 379 380 carry_over = schema.Bool( 381 title = u'Carry-over Course', 382 default = False, 383 required = False, 384 readonly = False, 385 ) 386 380 387 def getLevel(): 381 388 """Returns the id of the level the ticket has been added to. -
main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py
r7536 r7661 59 59 ticket.core_or_elective = val.core_or_elective 60 60 ticket.title = val.course.title 61 ticket.faculty = val.course.__parent__.__parent__.__parent__.title62 ticket.department = val.course.__parent__.__parent__.title63 61 ticket.fcode = val.course.__parent__.__parent__.__parent__.code 64 62 ticket.dcode = val.course.__parent__.__parent__.code … … 66 64 ticket.passmark = val.course.passmark 67 65 ticket.semester = val.course.semester 68 self[str(studylevel.level)][val.getCourseCode()] = ticket 66 self[str(studylevel.level)][ticket.code] = ticket 67 # Collect carry-over courses in base levels (not in repeating levels) 68 if studylevel.level % 100 == 0: 69 levels = sorted(self.keys()) 70 index = levels.index(str(studylevel.level)) 71 if index > 0: 72 previous_level = self[levels[index-1]] 73 for key, val in previous_level.items(): 74 if val.score < val.passmark: 75 if key in self[str(studylevel.level)]: 76 # Carry-over ticket exists 77 continue 78 co_ticket = CourseTicket() 79 for name in ['code', 'title', 'credits', 'passmark', 80 'semester', 'core_or_elective', 81 'fcode', 'dcode']: 82 setattr(co_ticket, name, getattr(val, name)) 83 co_ticket.automatic = True 84 co_ticket.carry_over = True 85 self[str(studylevel.level)][co_ticket.code] = co_ticket 69 86 return 70 87 -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7650 r7661 640 640 self.browser.getControl(name="addlevel").value = ['100'] 641 641 self.browser.getControl("Add study level").click() 642 self.browser.getControl(name="addlevel").value = ['100']643 642 644 643 # Managers can view and manage course lists … … 669 668 self.browser.getControl("Save").click() 670 669 self.assertTrue('Form has been saved' in self.browser.contents) 670 # Carry-over courses will be collected when next level is created 671 self.browser.open(self.student_path + '/studycourse/manage') 672 # Add next level 673 self.browser.getControl(name="addlevel").value = ['200'] 674 self.browser.getControl("Add study level").click() 675 self.browser.getLink("200").click() 676 self.assertMatches( 677 '...: Study Level 200 (Year 2)...', self.browser.contents) 678 # COURSE1 has score 0 and thus will become a carry-over course 679 # in level 200 680 self.assertEqual( 681 sorted(self.student['studycourse']['200'].keys()), [u'COURSE1']) 682 self.assertTrue( 683 self.student['studycourse']['200']['COURSE1'].carry_over) 671 684 return 672 685 … … 1174 1187 self.browser.getControl(name="form.course").value = ['COURSE1'] 1175 1188 self.browser.getControl("Add course ticket").click() 1176 self.assertMatches('...Successfully added COURSE1...', 1177 self.browser.contents) 1189 self.assertMatches('...The ticket exists...', 1190 self.browser.contents) 1191 # Indeed the ticket exists as carry-over course from level 100 1192 # since its score was 0 1193 self.assertTrue( 1194 self.student['studycourse']['200']['COURSE1'].carry_over is True) 1178 1195 # Students can open the pdf course registration slip 1179 1196 self.browser.open(self.student_path + '/studycourse/200') … … 1185 1202 self.browser.getControl("Remove selected", index=0).click() 1186 1203 self.assertTrue('No ticket selected' in self.browser.contents) 1204 # No ticket can be selected since the carry-over course is a core course 1205 self.assertRaises( 1206 LookupError, self.browser.getControl, name='val_id') 1207 self.student['studycourse']['200']['COURSE1'].core_or_elective = False 1208 self.browser.open(self.student_path + '/studycourse/200/edit') 1209 # Now the student can remove the ticket 1187 1210 ctrl = self.browser.getControl(name='val_id') 1188 1211 ctrl.getControl(value='COURSE1').selected = True
Note: See TracChangeset for help on using the changeset viewer.