Changeset 10681 for main


Ignore:
Timestamp:
1 Nov 2013, 07:59:47 (11 years ago)
Author:
Henrik Bettermann
Message:

Set maintenance fee for each hostel.

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

Legend:

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

    r10647 r10681  
    199199        hostel.hostel_id = u'hall-1'
    200200        hostel.hostel_name = u'Hall 1'
     201        hostel.maint_fee = 876.0
    201202        self.app['hostels'].addHostel(hostel)
    202203        bed = Bed()
     
    29412942        self.assertMatches('...Payment ticket created...',
    29422943                           self.browser.contents)
     2944
     2945        ctrl = self.browser.getControl(name='val_id')
     2946        value = ctrl.options[0]
     2947        # Maintennace fee is taken from the hostel object
     2948        self.assertEqual(self.student['payments'][value].amount_auth, 876.0)
     2949        # If the hostel's maintenance fee isn't set, the fee is
     2950        # taken from the session configuration object.
     2951        self.app['hostels']['hall-1'].maint_fee = 0.0
     2952        self.browser.open(self.payments_path + '/addop')
     2953        self.browser.getControl(name="form.p_category").value = ['hostel_maintenance']
     2954        self.browser.getControl("Create ticket").click()
     2955        ctrl = self.browser.getControl(name='val_id')
     2956        value = ctrl.options[1]
     2957        self.assertEqual(self.student['payments'][value].amount_auth, 987.0)
    29432958        return
    29442959
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r10650 r10681  
    406406            amount = academic_session.booking_fee
    407407        elif category == 'hostel_maintenance':
    408             amount = academic_session.maint_fee
     408            amount = 0.0
    409409            bedticket = student['accommodation'].get(
    410410                str(student.current_session), None)
    411411            if bedticket:
    412412                p_item = bedticket.bed_coordinates
     413                if bedticket.bed.__parent__.maint_fee > 0:
     414                    amount = bedticket.bed.__parent__.maint_fee
     415                else:
     416                    # fallback
     417                    amount = academic_session.maint_fee
    413418            else:
    414419                # Should not happen because this is already checked
Note: See TracChangeset for help on using the changeset viewer.