Changeset 15986 for main/waeup.kofa/trunk/src
- Timestamp:
- 4 Feb 2020, 18:33:48 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15972 r15986 155 155 view.flash(warning, type="warning") 156 156 return False 157 warning = students_utils.warnCourseAlreadyPassed(view.context, course) 158 if warning: 159 view.flash(warning, type="warning") 160 return False 157 161 try: 158 162 view.context.addCourseTicket(ticket, course) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15972 r15986 2834 2834 return 2835 2835 2836 def test_student_course_already_passed(self): 2837 IWorkflowState(self.student).setState('school fee paid') 2838 self.student['studycourse'].current_level = 100 2839 self.browser.open(self.login_path) 2840 self.browser.getControl(name="form.login").value = self.student_id 2841 self.browser.getControl(name="form.password").value = 'spwd' 2842 self.browser.getControl("Login").click() 2843 # Now students can add the current study level 2844 self.browser.getLink("Study Course").click() 2845 self.browser.getLink("Add course list").click() 2846 self.assertMatches('...Add current level 100 (Year 1)...', 2847 self.browser.contents) 2848 self.browser.getControl("Create course list now").click() 2849 # A level with one course ticket was created 2850 self.assertEqual(self.student['studycourse']['100'].number_of_tickets, 1) 2851 # We set the score above the passmark 2852 self.student['studycourse']['100'][ 2853 'COURSE1'].score = self.student['studycourse']['100'][ 2854 'COURSE1'].passmark + 1 2855 # We add a second level 2856 self.student['studycourse'].current_level = 200 2857 self.browser.getLink("Study Course").click() 2858 self.browser.getLink("Add course list").click() 2859 self.assertMatches('...Add current level 200 (Year 2)...', 2860 self.browser.contents) 2861 self.browser.getControl("Create course list now").click() 2862 self.browser.getLink("200").click() 2863 self.browser.getLink("Edit course list").click() 2864 self.browser.getLink("here").click() 2865 self.browser.getControl(name="form.course").value = ['COURSE1'] 2866 self.browser.getControl("Add course ticket").click() 2867 self.assertTrue( 2868 'Course has already been passed at previous level' 2869 in self.browser.contents) 2870 self.assertEqual(self.student['studycourse']['200'].number_of_tickets, 0) 2871 # We set the score below the passmark 2872 self.student['studycourse']['100'][ 2873 'COURSE1'].score = self.student['studycourse']['100'][ 2874 'COURSE1'].passmark - 1 2875 self.browser.getControl("Add course ticket").click() 2876 self.assertTrue( 2877 'Successfully added COURSE1' in self.browser.contents) 2878 self.assertEqual(self.student['studycourse']['200'].number_of_tickets, 1) 2879 return 2880 2836 2881 def test_student_course_registration_outstanding(self): 2837 2882 self.course = createObject('waeup.Course') -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r15984 r15986 732 732 return 733 733 734 def warnCourseAlreadyPassed(self, studylevel, course): 735 """Return message if course has already been passed at 736 previous levels. 737 """ 738 for slevel in studylevel.__parent__.values(): 739 for cticket in slevel.values(): 740 if cticket.code == course.code \ 741 and cticket.total_score >= cticket.passmark: 742 return _('Course has already been passed at previous level.') 743 return False 744 734 745 def getBedCoordinates(self, bedticket): 735 746 """Return descriptive bed coordinates.
Note: See TracChangeset for help on using the changeset viewer.