Changeset 13244 for main/waeup.uniben/trunk
- Timestamp:
- 4 Sep 2015, 17:17:03 (9 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r12566 r13244 47 47 new_session = student['studycourse'].current_session + 1 48 48 return new_session, new_level 49 50 def getAccommodationDetails(self, student): 51 """Determine the accommodation data of a student. 52 """ 53 d = {} 54 d['error'] = u'' 55 hostels = grok.getSite()['hostels'] 56 d['booking_session'] = hostels.accommodation_session 57 d['allowed_states'] = hostels.accommodation_states 58 d['startdate'] = hostels.startdate 59 d['enddate'] = hostels.enddate 60 d['expired'] = hostels.expired 61 # Determine bed type 62 studycourse = student['studycourse'] 63 certificate = getattr(studycourse,'certificate',None) 64 entry_session = studycourse.entry_session 65 current_level = studycourse.current_level 66 if None in (entry_session, current_level, certificate): 67 return d 68 end_level = certificate.end_level 69 if current_level == 10: 70 bt = 'pr' 71 elif entry_session == grok.getSite()['hostels'].accommodation_session: 72 bt = 'fr' 73 elif current_level >= end_level: 74 bt = 'fi' 75 else: 76 bt = 're' 77 if student.sex == 'f': 78 sex = 'female' 79 else: 80 sex = 'male' 81 special_handling = 'regular' 82 d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt) 83 return d 49 84 50 85 def _paymentMade(self, student, session): -
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.