Ignore:
Timestamp:
11 Mar 2016, 14:21:02 (9 years ago)
Author:
Henrik Bettermann
Message:

Configure hostel allocation for pg students.

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

    r13756 r13777  
    633633        self.assertEqual(error, None)
    634634
     635        self.certificate.study_mode = 'ug_ft'
    635636        error, payment = utils.setPaymentDetails('bed_allocation',
    636637            self.student, None, None)
     
    645646        self.assertEqual(payment.amount_auth, 650.0) # plus 500 student union
    646647        self.assertEqual(payment.p_item, u'regular_male_fr')
     648        self.assertEqual(error, None)
     649
     650        self.certificate.study_mode = 'pg_ft'
     651        error, payment = utils.setPaymentDetails('bed_allocation',
     652            self.student, None, None)
     653        self.assertEqual(payment.p_level, 100)
     654        self.assertEqual(payment.p_session, 2004)
     655        self.assertEqual(payment.amount_auth, 150.0)
     656        self.assertEqual(payment.p_item, u'pg_male_all')
    647657        self.assertEqual(error, None)
    648658
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r13757 r13777  
    6565            else:
    6666                return _("Outside booking period.")
    67         if student.current_mode != 'ug_ft':
     67        if not student.is_postgrad and student.current_mode != 'ug_ft':
    6868            return _("Only undergraduate full-time students are eligible to book accommodation.")
    6969        bt = acc_details.get('bt')
     
    7777                     'match accommodation session.')
    7878        stage = bt.split('_')[2]
    79         if stage != 'fr' and not student[
     79        if not student.is_postgrad and stage != 'fr' and not student[
    8080            'studycourse'].previous_verdict in ('A', 'B', 'F', 'J', 'C', 'Z'):
    8181            return _("Your are not eligible to book accommodation.")
     
    104104        if None in (entry_session, current_level, certificate):
    105105            return d
    106         end_level = certificate.end_level
    107         if current_level == 10:
    108             bt = 'pr'
    109         elif entry_session == grok.getSite()['hostels'].accommodation_session:
    110             bt = 'fr'
    111         elif current_level >= end_level:
    112             bt = 'fi'
    113         else:
    114             bt = 're'
    115106        if student.sex == 'f':
    116107            sex = 'female'
    117108        else:
    118109            sex = 'male'
    119         special_handling = 'regular'
    120         if student.faccode in ('MED', 'DEN'):
    121             special_handling = 'clinical'
    122         elif student.certcode in ('BARTMAS', 'BARTTHR', 'BARTFAA',
    123                                   'BAEDFAA', 'BSCEDECHED'):
    124             special_handling = 'ekenwan'
     110        if student.is_postgrad:
     111            bt = 'all'
     112            special_handling = 'pg'
     113        else:
     114            end_level = certificate.end_level
     115            if current_level == 10:
     116                bt = 'pr'
     117            elif entry_session == grok.getSite()['hostels'].accommodation_session:
     118                bt = 'fr'
     119            elif current_level >= end_level:
     120                bt = 'fi'
     121            else:
     122                bt = 're'
     123            special_handling = 'regular'
     124            if student.faccode in ('MED', 'DEN'):
     125                special_handling = 'clinical'
     126            elif student.certcode in ('BARTMAS', 'BARTTHR', 'BARTFAA',
     127                                      'BAEDFAA', 'BSCEDECHED'):
     128                special_handling = 'ekenwan'
    125129        d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt)
    126130        return d
     
    194198            amount = academic_session.booking_fee
    195199            # Add student union dues
    196             stage = self.getAccommodationDetails(student)['bt']
    197             stage = stage.split('_')[2]
    198             #####################################################
    199             #if stage == 'fi':
    200             #    return _('Payment temporarily disabled.'), None
    201             #####################################################
    202             if stage == 'fr':
    203                 amount += 500.0
    204             elif stage in ('fi', 're') and student[
    205                 'studycourse'].previous_verdict in ('A', 'B', 'F', 'J', 'C', 'Z'):
    206                 amount += 300.0
    207             else:
    208                 amount = 0.0
     200            if not student.is_postgrad:
     201                stage = self.getAccommodationDetails(student)['bt']
     202                stage = stage.split('_')[2]
     203                if stage == 'fr':
     204                    amount += 500.0
     205                elif stage in ('fi', 're') and student[
     206                    'studycourse'].previous_verdict in ('A', 'B', 'F', 'J', 'C', 'Z'):
     207                    amount += 300.0
     208                else:
     209                    amount = 0.0
    209210        elif category == 'hostel_maintenance':
    210211            amount = 0.0
Note: See TracChangeset for help on using the changeset viewer.