Ignore:
Timestamp:
31 Jan 2020, 12:12:17 (5 years ago)
Author:
Henrik Bettermann
Message:

Don't allow students to add former courses in course lists.

Location:
main/waeup.kofa/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r15969 r15970  
    441.6.1.dev0 (unreleased)
    55=======================
     6
     7* Don't allow students to add former courses in course lists.
    68
    79* Use kofa-filterbox for filtering users when assigniing
  • main/waeup.kofa/trunk/src/waeup/kofa/permissions.py

    r15968 r15970  
    294294    The LocalReportsOfficer requires the assignment of the global
    295295    ReportsOfficer role to access the reports section. If set, it reduces
    296     the number of available report generators and selectable certificates
    297     Local Reports Officer can create only reports for their department.
     296    the number of available report generators and selectable certificates.
     297    Local Reports Officers can create only reports for their department.
    298298    """
    299299    grok.name('waeup.local.ReportsOfficer')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r15941 r15970  
    29602960                return
    29612961            course = list(result)[0]
     2962            if course.former_course:
     2963                self.flash(_('Former courses can\'t be added.'), type="warning")
     2964                return
    29622965            addCourseTicket(self, course)
    29632966        return
     
    30833086            return
    30843087        course = data['course']
     3088        if course.former_course:
     3089            self.flash(_('Former courses can\'t be added.'), type="warning")
     3090            return
    30853091        success = addCourseTicket(self, course)
    30863092        if success:
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r15918 r15970  
    35673567        self.assertEqual(self.student.state, 'courses registered')
    35683568
     3569    def test_former_course(self):
     3570        IWorkflowState(self.student).setState('school fee paid')
     3571        self.student['studycourse'].current_level = 100
     3572        self.browser.open(self.login_path)
     3573        self.browser.getControl(name="form.login").value = self.student_id
     3574        self.browser.getControl(name="form.password").value = 'spwd'
     3575        self.browser.getControl("Login").click()
     3576        # Now students can add the current study level
     3577        self.browser.getLink("Study Course").click()
     3578        self.browser.getLink("Add course list").click()
     3579        self.assertMatches('...Add current level 100 (Year 1)...',
     3580                           self.browser.contents)
     3581        self.browser.getControl("Create course list now").click()
     3582        # A level with one course ticket was created
     3583        self.assertEqual(
     3584            self.student['studycourse']['100'].number_of_tickets, 1)
     3585        self.browser.getLink("100").click()
     3586        self.assertTrue('<td>Unnamed Course</td>' in self.browser.contents)
     3587        self.browser.getLink("Edit course list").click()
     3588        del self.student['studycourse']['100']['COURSE1']
     3589        # Course can be added again via CourseTicketAddFormPage2
     3590        self.browser.getLink("here").click()
     3591        self.browser.getControl(name="form.course").value = ['COURSE1']
     3592        self.browser.getControl("Add course ticket").click()
     3593        self.assertTrue('Successfully added COURSE1' in self.browser.contents)
     3594        self.assertEqual(len(self.student['studycourse']['100'].keys()),1)
     3595        del self.student['studycourse']['100']['COURSE1']
     3596        self.course.former_course = True
     3597        self.browser.getLink("here").click()
     3598        self.browser.getControl(name="form.course").value = ['COURSE1']
     3599        self.browser.getControl("Add course ticket").click()
     3600        self.assertTrue('Former courses can\'t be added.' in self.browser.contents)
     3601        self.assertEqual(len(self.student['studycourse']['100'].keys()),0)
     3602        # Course can be added again via StudyLevelEditFormPage
     3603        self.browser.getLink("100").click()
     3604        self.browser.getLink("Edit course list").click()
     3605        self.browser.getControl(name="course").value = 'COURSE1'
     3606        self.browser.getControl("Add course ticket").click()
     3607        self.assertTrue('Former courses can\'t be added.' in
     3608            self.browser.contents)
     3609        self.assertEqual(len(self.student['studycourse']['100'].keys()),0)
     3610        # but added if current course
     3611        self.course.former_course = False
     3612        self.browser.getControl(name="course").value = 'COURSE1'
     3613        self.browser.getControl("Add course ticket").click()
     3614        self.assertTrue('Successfully added COURSE1' in self.browser.contents)
     3615        self.assertEqual(len(self.student['studycourse']['100'].keys()),1)
     3616        return
    35693617
    35703618class StudentRequestPWTests(StudentsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.