Changeset 13416 for main/waeup.aaue/trunk
- Timestamp:
- 9 Nov 2015, 10:56:53 (9 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r13406 r13416 25 25 from mechanize import LinkNotFoundError 26 26 from hurry.workflow.interfaces import IWorkflowState 27 from zope.event import notify 27 28 from zope.component.hooks import setSite, clearSite 28 29 from zope.component import getUtility, createObject, queryUtility … … 549 550 def test_student_accommodation(self): 550 551 del self.student['accommodation']['2004'] 552 # All beds can be assigned 553 bed1 = self.app['hostels']['hall-1']['hall-1_A_101_A'] 554 bed1.bed_type = u'regular_male_all' 555 bed2 = self.app['hostels']['hall-1']['hall-1_A_101_B'] 556 bed2.bed_type = u'regular_female_all' 557 notify(grok.ObjectModifiedEvent(bed1)) 558 notify(grok.ObjectModifiedEvent(bed2)) 551 559 # Login 552 560 self.browser.open(self.login_path) … … 563 571 # one bed for this student, we know that 564 572 self.assertEqual(self.student['accommodation']['2004'].bed_coordinates, 565 'Hall 1, Block A, Room 101, Bed A (regular_male_ fr)')573 'Hall 1, Block A, Room 101, Bed A (regular_male_all)') 566 574 # Only the hall name is displayed 567 575 self.assertEqual(self.student['accommodation']['2004'].display_coordinates, -
main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py
r13415 r13416 251 251 d['expired'] = hostels.expired 252 252 # Determine bed type 253 studycourse = student['studycourse'] 254 certificate = getattr(studycourse,'certificate',None) 255 entry_session = studycourse.entry_session 256 current_level = studycourse.current_level 257 if None in (entry_session, current_level, certificate): 258 return d 259 end_level = certificate.end_level 260 if current_level == 10: 261 bt = 'pr' 262 elif entry_session == grok.getSite()['hostels'].accommodation_session: 263 bt = 'fr' 264 elif current_level >= end_level: 265 bt = 'fi' 266 else: 267 bt = 're' 253 bt = 'all' 268 254 if student.sex == 'f': 269 255 sex = 'female'
Note: See TracChangeset for help on using the changeset viewer.