Ignore:
Timestamp:
24 Oct 2018, 03:16:25 (6 years ago)
Author:
Henrik Bettermann
Message:

Customize getAccommodationDetails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py

    r15183 r15196  
    272272
    273273        return _('Matriculation number cannot be set.'), None
     274
     275    def getAccommodationDetails(self, student):
     276        """Determine the accommodation data of a student.
     277        """
     278        d = {}
     279        d['error'] = u''
     280        hostels = grok.getSite()['hostels']
     281        d['booking_session'] = hostels.accommodation_session
     282        d['allowed_states'] = hostels.accommodation_states
     283        d['startdate'] = hostels.startdate
     284        d['enddate'] = hostels.enddate
     285        d['expired'] = hostels.expired
     286        # Determine bed type
     287        studycourse = student['studycourse']
     288        certificate = getattr(studycourse,'certificate',None)
     289        entry_session = studycourse.entry_session
     290        current_level = studycourse.current_level
     291        if None in (entry_session, current_level, certificate):
     292            return d
     293        bt = 'all'
     294        if student.sex == 'f':
     295            sex = 'female'
     296        else:
     297            sex = 'male'
     298        special_handling = 'regular'
     299        d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt)
     300        return d
Note: See TracChangeset for help on using the changeset viewer.