Ignore:
Timestamp:
24 Oct 2012, 05:58:57 (12 years ago)
Author:
Henrik Bettermann
Message:

Customize SPECIAL_HANDLING_DICT and getAccommodationDetails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py

    r9298 r9402  
    131131        return None, payment
    132132
     133    def getAccommodationDetails(self, student):
     134        """Determine the accommodation data of a student.
     135        """
     136        d = {}
     137        d['error'] = u''
     138        hostels = grok.getSite()['hostels']
     139        d['booking_session'] = hostels.accommodation_session
     140        d['allowed_states'] = hostels.accommodation_states
     141        d['startdate'] = hostels.startdate
     142        d['enddate'] = hostels.enddate
     143        d['expired'] = hostels.expired
     144        # Determine bed type
     145        studycourse = student['studycourse']
     146        certificate = getattr(studycourse,'certificate',None)
     147        entry_session = studycourse.entry_session
     148        current_level = studycourse.current_level
     149        if None in (entry_session, current_level, certificate):
     150            return d
     151        end_level = certificate.end_level
     152        if current_level == 10:
     153            bt = 'pr'
     154        elif entry_session == grok.getSite()['hostels'].accommodation_session:
     155            bt = 'fr'
     156        elif current_level >= end_level:
     157            bt = 'fi'
     158        else:
     159            bt = 're'
     160        sex = 'male'
     161        if student.sex == 'f':
     162            sex = 'female'
     163        special_handling = 'regular'
     164        if student.faccode == 'SSE':
     165            special_handling = 'sse'
     166        d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt)
     167        return d
     168
    133169
    134170    # FUTMinna prefix
Note: See TracChangeset for help on using the changeset viewer.