Changeset 13416


Ignore:
Timestamp:
9 Nov 2015, 10:56:53 (9 years ago)
Author:
Henrik Bettermann
Message:

Customize getAccommodationDetails.

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  
    2525from mechanize import LinkNotFoundError
    2626from hurry.workflow.interfaces import IWorkflowState
     27from zope.event import notify
    2728from zope.component.hooks import setSite, clearSite
    2829from zope.component import getUtility, createObject, queryUtility
     
    549550    def test_student_accommodation(self):
    550551        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))
    551559        # Login
    552560        self.browser.open(self.login_path)
     
    563571        # one bed for this student, we know that
    564572        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)')
    566574        # Only the hall name is displayed
    567575        self.assertEqual(self.student['accommodation']['2004'].display_coordinates,
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r13415 r13416  
    251251        d['expired'] = hostels.expired
    252252        # 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'
    268254        if student.sex == 'f':
    269255            sex = 'female'
Note: See TracChangeset for help on using the changeset viewer.