Changeset 14684
- Timestamp:
- 13 May 2017, 16:50:36 (8 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r14682 r14684 4 4 1.6.dev0 (unreleased) 5 5 ======================= 6 7 * Add 'Update all tickets' button to StudyLevelEditFormPage. 6 8 7 9 * Do not allow to create more than 10 students with a single request to -
main/waeup.kofa/trunk/docs/source/userdocs/students/browser.rst
r14657 r14684 260 260 (non-mandatory) course tickets (condition customizable). 261 261 262 The edit form page provides a 'Register course list' button which 263 submits the course list to the course adviser for validation. If the 264 course registration deadline 262 The edit form page provides two additional buttons. 'Update all 263 tickets' ignores the select boxes and checks all course ticket at 264 that level. It looks up the associated course object for each ticket 265 and updates the ticket's course parameters (including course title) 266 if needed. Attention: If a course was removed, the associated 267 course ticket will be invalidated by adding '(course cancelled)' to 268 the title and setting the credits to zero. The 'Register course 269 list' button submits the course list to the course adviser for 270 validation. If the course registration deadline 265 271 (`ISessionConfiguration.coursereg_deadline`) is set and the 266 272 registration period has expired, a late registration fee -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r14649 r14684 2724 2724 return 2725 2725 2726 def _updateTickets(self, **data): 2727 cat = queryUtility(ICatalog, name='courses_catalog') 2728 invalidated = list() 2729 for value in self.context.values(): 2730 result = cat.searchResults(code=(value.code, value.code)) 2731 if len(result) != 1: 2732 course = None 2733 else: 2734 course = list(result)[0] 2735 invalid = self.context.updateCourseTicket(value, course) 2736 if invalid: 2737 invalidated.append(invalid) 2738 if invalidated: 2739 invalidated_string = ', '.join(invalidated) 2740 self.context.writeLogMessage( 2741 self, 'course tickets invalidated: %s' % invalidated_string) 2742 self.flash(_('All course tickets updated.')) 2743 return 2744 2745 @action(_('Update all tickets'), 2746 tooltip=_('Update all course parameters including course titles.')) 2747 def updateTickets(self, **data): 2748 self._updateTickets(**data) 2749 return 2750 2726 2751 def _registerCourses(self, **data): 2727 2752 if self.context.student.is_postgrad and \ -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r14655 r14684 646 646 """ 647 647 648 def updateCourseTicket(ticket, course): 649 """Updates a course ticket object and return code 650 if ticket has been invalidated. 651 """ 652 648 653 class ICourseTicket(IKofaObject): 649 654 """A representation of course ticket data. -
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r14642 r14684 268 268 return 269 269 270 def updateCourseTicket(self, ticket, course): 271 """Updates a course ticket object and return code 272 if ticket has been invalidated. 273 """ 274 if not course: 275 if ticket.title.endswith('cancelled)'): 276 # Skip this tiket 277 return 278 # Invalidate course ticket 279 ticket.title += u' (course cancelled)' 280 ticket.credits = 0 281 ticket.passmark = 0 282 return ticket.code 283 ticket.code = course.code 284 ticket.title = course.title 285 ticket.fcode = course.__parent__.__parent__.__parent__.code 286 ticket.dcode = course.__parent__.__parent__.code 287 ticket.credits = course.credits 288 ticket.passmark = course.passmark 289 ticket.semester = course.semester 290 return 291 270 292 StudentStudyLevel = attrs_to_fields( 271 293 StudentStudyLevel, omit=['total_credits', 'gpa']) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r14642 r14684 2578 2578 return 2579 2579 2580 def test_student_ticket_update(self): 2581 IWorkflowState(self.student).setState('school fee paid') 2582 self.student['studycourse'].current_level = 100 2583 self.browser.open(self.login_path) 2584 self.browser.getControl(name="form.login").value = self.student_id 2585 self.browser.getControl(name="form.password").value = 'spwd' 2586 self.browser.getControl("Login").click() 2587 # Now students can add the current study level 2588 self.browser.getLink("Study Course").click() 2589 self.browser.getLink("Add course list").click() 2590 self.assertMatches('...Add current level 100 (Year 1)...', 2591 self.browser.contents) 2592 self.browser.getControl("Create course list now").click() 2593 # A level with one course ticket was created 2594 self.assertEqual( 2595 self.student['studycourse']['100'].number_of_tickets, 1) 2596 self.browser.getLink("100").click() 2597 self.assertTrue('<td>Unnamed Course</td>' in self.browser.contents) 2598 self.browser.getLink("Edit course list").click() 2599 self.browser.getControl("Update all tickets").click() 2600 self.assertTrue('All course tickets updated.' in self.browser.contents) 2601 # ... nothing has changed 2602 self.assertTrue('<td>Unnamed Course</td>' in self.browser.contents) 2603 # We change the title of the course 2604 self.course.title = u'New Title' 2605 self.browser.getControl("Update all tickets").click() 2606 self.assertTrue('<td>New Title</td>' in self.browser.contents) 2607 # We remove the course 2608 del self.app['faculties']['fac1']['dep1'].courses['COURSE1'] 2609 self.browser.getControl("Update all tickets").click() 2610 self.assertTrue(' <td>New Title (course cancelled)</td>' 2611 in self.browser.contents) 2612 # Course ticket invalidation has been logged 2613 logfile = os.path.join( 2614 self.app['datacenter'].storage, 'logs', 'students.log') 2615 logcontent = open(logfile).read() 2616 self.assertTrue( 2617 'K1000000 - students.browser.StudyLevelEditFormPage - ' 2618 'K1000000 - course tickets invalidated: COURSE1' 2619 in logcontent) 2620 return 2621 2580 2622 def test_student_course_registration_outstanding(self): 2581 2623 self.course = createObject('waeup.Course')
Note: See TracChangeset for help on using the changeset viewer.