Changeset 13242 for main/waeup.uniben/trunk/src/waeup
- Timestamp:
- 4 Sep 2015, 15:04:46 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py
r13137 r13242 108 108 EXAM_GRADES = NigeriaKofaUtils.EXAM_GRADES + (('B1', 'B1'), ('P', 'P'),) 109 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_session 117 d['allowed_states'] = hostels.accommodation_states 118 d['startdate'] = hostels.startdate 119 d['enddate'] = hostels.enddate 120 d['expired'] = hostels.expired 121 # Determine bed type 122 studycourse = student['studycourse'] 123 certificate = getattr(studycourse,'certificate',None) 124 entry_session = studycourse.entry_session 125 current_level = studycourse.current_level 126 if None in (entry_session, current_level, certificate): 127 return d 128 end_level = certificate.end_level 129 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 d 110 144 145
Note: See TracChangeset for help on using the changeset viewer.