Changeset 17176 for main/waeup.kofa/trunk/src
- Timestamp:
- 25 Nov 2022, 11:54:59 (2 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py
r15250 r17176 28 28 bed_letters, blocks, SpecialHandlingSource, 29 29 NOT_OCCUPIED) 30 from waeup.kofa.students.interfaces import (IStudentsUtils) 30 31 31 32 # Define a validation method for sort ids … … 285 286 return 286 287 catalog = getUtility(ICatalog, name='students_catalog') 288 accommodation_span = getUtility(IStudentsUtils).ACCOMMODATION_SPAN 287 289 accommodation_session = getSite()['hostels'].accommodation_session 288 290 students = catalog.searchResults(current_session=( 289 accommodation_session ,accommodation_session))291 accommodation_session-accommodation_span,accommodation_session)) 290 292 student_ids = [student.student_id for student in students] 291 293 if not bed.owner in student_ids: 292 294 raise Invalid(_( 293 295 "Either student does not exist or student " 294 "is not in accommodation session."))296 "is not eligible to book accommodation.")) 295 297 catalog = getUtility(ICatalog, name='beds_catalog') 296 298 beds = catalog.searchResults(owner=(bed.owner,bed.owner)) -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r15250 r17176 452 452 self.assertMatches( 453 453 "...Either student does not exist or student " 454 "is not in accommodation session...",454 "is not eligible to book accommodation...", 455 455 self.browser.contents) 456 456 self.browser.getControl(name="form.owner").value = self.student_id -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r16939 r17176 2264 2264 p_combi = [p_combi,] 2265 2265 student = self.context.__parent__ 2266 students_utils = getUtility(IStudentsUtils) 2266 2267 # The hostel_application payment category is temporarily used 2267 2268 # by Uniben. 2268 if p_category in ('bed_allocation', 'hostel_application') and student[ 2269 'studycourse'].current_session != grok.getSite()[ 2270 'hostels'].accommodation_session: 2269 if p_category in ( 2270 'bed_allocation', 'hostel_application') and grok.getSite()[ 2271 'hostels'].accommodation_session - student[ 2272 'studycourse'].current_session > students_utils.ACCOMMODATION_SPAN: 2271 2273 self.flash( 2272 _('Your current session does not match' + \2273 ' accommodation session.'), type="danger")2274 _('Your current session does not allow ' + \ 2275 'to book accommodation.'), type="danger") 2274 2276 return 2275 2277 if 'maintenance' in p_category: … … 2279 2281 type="warning") 2280 2282 return 2281 students_utils = getUtility(IStudentsUtils)2282 2283 error, payment = students_utils.setPaymentDetails( 2283 2284 p_category, student, None, None, p_combi) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r16834 r17176 1416 1416 self.app['hostels'].accommodation_session = 2011 1417 1417 self.browser.getControl("Create ticket").click() 1418 self.assertMatches('...Your current session does not match...',1418 self.assertMatches('...Your current session does not allow...', 1419 1419 self.browser.contents) 1420 1420 self.app['hostels'].accommodation_session = 2004 … … 1439 1439 self.student['studycourse'].current_session = 2003 1440 1440 self.browser.getControl("Book accommodation").click() 1441 self.assertMatches('...Your current session does not match...', 1442 self.browser.contents) 1441 self.assertMatches( 1442 '...Your current session does not allow to book accommodation...', 1443 self.browser.contents) 1443 1444 self.student['studycourse'].current_session = 2004 1444 1445 # All requirements are met and ticket can be created -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r16966 r17176 654 654 return d 655 655 656 ACCOMMODATION_SPAN = 0 657 656 658 def checkAccommodationRequirements(self, student, acc_details): 657 659 if acc_details.get('expired', False): … … 672 674 if not student.state in acc_details['allowed_states']: 673 675 return _("You are in the wrong registration state.") 674 if student['studycourse'].current_session != acc_details[675 ' booking_session']:676 return _('Your current session does not '677 'match accommodation session.')676 if acc_details['booking_session'] - student[ 677 'studycourse'].current_session > self.ACCOMMODATION_SPAN: 678 return _('Your current session does not allow ' + \ 679 'to book accommodation.') 678 680 bsession = str(acc_details['booking_session']) 679 681 if bsession in student['accommodation'].keys() \
Note: See TracChangeset for help on using the changeset viewer.