Changeset 9431


Ignore:
Timestamp:
26 Oct 2012, 20:59:03 (12 years ago)
Author:
Henrik Bettermann
Message:

Link maintenance payment with bedticket. This way we can forgo a secon maint. payment category. The amount depends now on the bed really booked.

Location:
main/waeup.futminna/trunk/src/waeup/futminna
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py

    r9410 r9431  
    116116        self.browser.getControl(name="form.p_category").value = ['hostel_maintenance']
    117117        self.browser.getControl("Create ticket").click()
     118        self.assertMatches('...You have not yet booked accommodation...',
     119                           self.browser.contents)
     120        # Students have to book bed first
     121        self.browser.open(self.acco_path)
     122        IWorkflowState(self.student).setState('admitted')
     123        self.browser.getLink("Book accommodation").click()
     124        self.assertFalse('Activation Code:' in self.browser.contents)
     125        self.browser.getControl("Create bed ticket").click()
     126        # Bed is randomly selected but, since there is only
     127        # one bed for this student, we know that ...
     128        self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
     129                           self.browser.contents)
     130        self.browser.open(self.payments_path + '/addop')
     131        self.browser.getControl(name="form.p_category").value = ['hostel_maintenance']
     132        self.browser.getControl("Create ticket").click()
    118133        self.assertMatches('...ticket created...',
    119134                           self.browser.contents)
  • main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py

    r9409 r9431  
    2828from waeup.kofa.university.department import Department
    2929from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     30from waeup.kofa.students.accommodation import BedTicket
    3031from waeup.kofa.testing import FunctionalTestCase
    3132from waeup.kofa.interfaces import (
     
    8788        self.app['faculties']['SSE']['dep1'].certificates.addCertificate(
    8889            self.certificate2)
     90        # Create EET faculty with certificate
     91        self.app['faculties']['EET'] = Faculty(code='EET')
     92        self.app['faculties']['EET']['dep1'] = Department(code='dep1')
     93        self.certificate3 = createObject('waeup.Certificate')
     94        self.certificate3.code = u'CERT3'
     95        self.certificate3.application_category = 'basic'
     96        self.certificate3.study_mode = 'ug_ft'
     97        self.certificate3.start_level = 100
     98        self.certificate3.end_level = 300
     99        self.app['faculties']['EET']['dep1'].certificates.addCertificate(
     100            self.certificate3)
    89101        # Set study course attributes of test student
    90102        self.student['studycourse'].certificate = self.certificate2
     
    160172
    161173        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
     174        self.assertEqual(error, 'You have not yet booked accommodation.')
     175        bedticket = BedTicket()
     176        bedticket.booking_session = 2004
     177        bedticket.bed_type = u'any bed type'
     178        bedticket.bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
     179        bedticket.bed_coordinates = u'My bed coordinates'
     180        self.student['accommodation'].addBedTicket(bedticket)
     181        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
    162182        self.assertEqual(payment.p_level, 100)
    163183        self.assertEqual(payment.p_session, 2004)
    164184        self.assertEqual(payment.amount_auth, 10000.0)
    165         self.assertEqual(payment.p_item, u'sse_male_fr')
    166         self.assertEqual(error, None)
    167 
    168         self.student['studycourse'].certificate = self.certificate
    169         error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
    170         self.assertEqual(payment.p_level, 100)
    171         self.assertEqual(payment.p_session, 2004)
    172         self.assertEqual(payment.amount_auth, 10000.0)
    173         self.assertEqual(payment.p_item, u'regular_male_fr')
    174         self.assertEqual(error, None)
    175 
    176         error, payment = utils.setPaymentDetails('block_h_maintenance',self.student)
     185        self.assertEqual(payment.p_item, u'My bed coordinates')
     186        self.assertEqual(error, None)
     187
     188        self.student['studycourse'].certificate = self.certificate3
     189        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
     190        self.assertEqual(payment.p_level, 100)
     191        self.assertEqual(payment.p_session, 2004)
     192        self.assertEqual(payment.amount_auth, 12000.0)
     193        self.assertEqual(payment.p_item, u'My bed coordinates')
     194        self.assertEqual(error, None)
     195
     196        bedticket.bed.bed_id = u'block-h_anything'
     197        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
    177198        self.assertEqual(payment.p_level, 100)
    178199        self.assertEqual(payment.p_session, 2004)
    179200        self.assertEqual(payment.amount_auth, 15000.0)
    180         self.assertEqual(payment.p_item, u'regular_male_fr')
     201        self.assertEqual(payment.p_item, u'My bed coordinates')
    181202        self.assertEqual(error, None)
    182203
  • main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py

    r9409 r9431  
    116116                amount = 20000.0
    117117        elif category == 'hostel_maintenance':
     118            current_session = student['studycourse'].current_session
     119            bedticket = student['accommodation'].get(str(current_session), None)
     120            if bedticket:
     121                p_item = bedticket.bed_coordinates
     122            else:
     123                return _(u'You have not yet booked accommodation.'), None
    118124            acc_details = self.getAccommodationDetails(student)
    119             if student['studycourse'].current_session != acc_details[
    120                 'booking_session']:
     125            if current_session != acc_details['booking_session']:
    121126                return _(u'Current session does not match accommodation session.'), None
    122             if student.current_level  in ('100','200','300','400','500') and \
     127            if bedticket.bed.bed_id.startswith('block-h'):
     128                amount = 15000.0
     129            elif student.current_level  in (100,200,300,400,500) and \
    123130                student.faccode in ('EET','SET','AAT','ICT','EMT'):
    124131                amount = 12000.0
    125132            else:
    126133                amount = 10000.0
    127             p_item = acc_details['bt']
    128         elif category == 'block_h_maintenance':
    129             acc_details = self.getAccommodationDetails(student)
    130             if student['studycourse'].current_session != acc_details[
    131                 'booking_session']:
    132                 return _(u'Current session does not match accommodation session.'), None
    133             amount = 15000.0
    134             p_item = acc_details['bt']
    135134        elif category == 'bed_allocation':
    136135            p_item = self.getAccommodationDetails(student)['bt']
  • main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py

    r9419 r9431  
    3636        'schoolfee': 'School Fee',
    3737        'clearance': 'Acceptance Fee',
    38         #'hostel_maintenance': 'Regular Hostel Maintenance Fee',
    39         #'block_h_maintenance': 'Block H Maintenance Fee',
     38        'hostel_maintenance': 'Hostel Maintenance Fee',
    4039        'application': 'Application Fee'
    4140        }
Note: See TracChangeset for help on using the changeset viewer.