Ignore:
Timestamp:
6 Oct 2015, 07:37:06 (9 years ago)
Author:
Henrik Bettermann
Message:

Further customize checkAccommodationRequirements.

Add student union dues to bed allocation fees.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r13252 r13283  
    907907
    908908    def test_student_accommodation(self):
     909        bed = Bed()
     910        bed.bed_id = u'hall-1_A_101_C'
     911        bed.bed_number = 3
     912        bed.owner = NOT_OCCUPIED
     913        bed.bed_type = u'regular_male_fi'
     914        self.app['hostels']['hall-1'].addBed(bed)
    909915        self.browser.open(self.login_path)
    910916        self.browser.getControl(name="form.login").value = self.student_id
     
    941947        self.assertMatches('...Your data are incomplete...',
    942948            self.browser.contents)
    943         self.student['studycourse'].current_level = 100
     949        self.student['studycourse'].current_level = 200
     950        # ... or student is not the an allowed state ...
     951        self.browser.getLink("Book accommodation").click()
     952        self.assertMatches('...You are in the wrong...',
     953                           self.browser.contents)
     954        self.app['hostels'].accommodation_states = ['admitted', 'school fee paid']
     955        IWorkflowState(self.student).setState('school fee paid')
    944956        # ... or student has not appropriate verdict (Uniben only!)
     957        self.student['studycourse'].entry_session = 2000 # non-fresh
     958        self.student['studycourse'].current_level = 500 # final-year
    945959        self.student['studycourse'].current_verdict = 'C'
    946960        self.browser.getLink("Book accommodation").click()
     
    948962            self.browser.contents)
    949963        self.student['studycourse'].current_verdict = 'A'
    950         # ... or student is not the an allowed state ...
    951         self.browser.getLink("Book accommodation").click()
    952         self.assertMatches('...You are in the wrong...',
    953                            self.browser.contents)
    954         IWorkflowInfo(self.student).fireTransition('admit')
    955964        self.browser.getLink("Book accommodation").click()
    956965        self.assertMatches('...Activation Code:...',
     
    970979                           self.browser.contents)
    971980        # The bed remains empty.
    972         bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
     981        bed = self.app['hostels']['hall-1']['hall-1_A_101_C']
    973982        self.assertTrue(bed.owner == NOT_OCCUPIED)
    974983        ac.owner = self.student_id
     
    976985        self.browser.getControl(name="ac_number").value = sfenumber
    977986        self.browser.getControl("Create bed ticket").click()
    978         self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
     987        self.assertMatches('...Hall 1, Block A, Room 101, Bed C...',
    979988                           self.browser.contents)
    980989        # Bed has been allocated.
     
    986995        # The bed ticket displays the data correctly.
    987996        self.browser.open(self.acco_path + '/2004')
    988         self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
     997        self.assertMatches('...Hall 1, Block A, Room 101, Bed C...',
    989998                           self.browser.contents)
    990999        self.assertMatches('...2004/2005...', self.browser.contents)
    991         self.assertMatches('...regular_male_fr...', self.browser.contents)
     1000        self.assertMatches('...regular_male_fi...', self.browser.contents)
    9921001        self.assertMatches('...%s...' % pin, self.browser.contents)
    9931002        # Students can open the pdf slip.
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r13252 r13283  
    6565            else:
    6666                return _("Outside booking period.")
    67         if not student.current_verdict in ('A', 'B'):
    68             return _("Your are not eligible to book accommodation.")
    69         if not acc_details.get('bt'):
     67        bt = acc_details.get('bt')
     68        if not bt:
    7069            return _("Your data are incomplete.")
    7170        if not student.state in acc_details['allowed_states']:
     
    7574            return _('Your current session does not '
    7675                     'match accommodation session.')
     76        stage = bt.split('_')[2]
     77        if stage not in ('fr', 'fi'):
     78            return _("Only fresh and final year students are allowed to book accommodation.")
     79        if stage != 'fr' and not student.current_verdict in ('A', 'B'):
     80            return _("Your are not eligible to book accommodation.")
    7781        if str(acc_details['booking_session']) in student['accommodation'].keys():
    7882            return _('You already booked a bed space in '
     
    137141            p_item = self.getAccommodationDetails(student)['bt']
    138142            amount = academic_session.booking_fee
     143            # Add student union dues
     144            stage = self.getAccommodationDetails(student)['bt']
     145            stage = stage.split('_')[2]
     146            if stage == 'fr':
     147                amount += 500.0
     148            else:
     149                amount += 300.0
    139150        elif category == 'hostel_maintenance':
    140151            amount = 0.0
Note: See TracChangeset for help on using the changeset viewer.