Changeset 13244 for main/waeup.uniben/trunk/src/waeup/uniben/utils
- Timestamp:
- 4 Sep 2015, 17:17:03 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py
r13242 r13244 107 107 108 108 EXAM_GRADES = NigeriaKofaUtils.EXAM_GRADES + (('B1', 'B1'), ('P', 'P'),) 109 110 def getAccommodationDetails(self, student):111 """Determine the accommodation data of a student.112 """113 d = {}114 d['error'] = u''115 hostels = grok.getSite()['hostels']116 d['booking_session'] = hostels.accommodation_session117 d['allowed_states'] = hostels.accommodation_states118 d['startdate'] = hostels.startdate119 d['enddate'] = hostels.enddate120 d['expired'] = hostels.expired121 # Determine bed type122 studycourse = student['studycourse']123 certificate = getattr(studycourse,'certificate',None)124 entry_session = studycourse.entry_session125 current_level = studycourse.current_level126 if None in (entry_session, current_level, certificate):127 return d128 end_level = certificate.end_level129 if current_level == 10:130 bt = 'pr'131 elif entry_session == grok.getSite()['hostels'].accommodation_session:132 bt = 'fr'133 elif current_level >= end_level:134 bt = 'fi'135 else:136 bt = 're'137 if student.sex == 'f':138 sex = 'female'139 else:140 sex = 'male'141 special_handling = 'regular'142 d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt)143 return d144 145
Note: See TracChangeset for help on using the changeset viewer.