Changeset 13318 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 14 Oct 2015, 13:15:03 (9 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/hostels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/container.py
r13316 r13318 60 60 cat = queryUtility(ICatalog, name='beds_catalog') 61 61 results = cat.searchResults(owner=(None, None)) 62 counter = 062 released = [] 63 63 for bed in results: 64 success = bed.releaseBedIfMaintenanceNotPaid(n=n) 65 if success: 66 counter += 1 67 return counter 64 student_id = bed.releaseBedIfMaintenanceNotPaid(n=n) 65 if student_id: 66 released.append('%s (%s)' % (bed.bed_id,student_id)) 67 if len(released): 68 message = ', '.join(released) 69 self.writeLogMessage(self, 'released: %s' % message) 70 return released 68 71 69 72 @property -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py
r13316 r13318 285 285 days_ago = getattr(jetzt - bedticket.booking_date, 'days') 286 286 if days_ago > n: 287 old_owner = self.owner 287 288 self.owner = NOT_OCCUPIED 288 289 notify(grok.ObjectModifiedEvent(self)) … … 292 293 bedticket.bed_coordinates = u'-- booking expired (%s) --' % ( 293 294 timestamp,) 294 return True295 return old_owner 295 296 return 296 297 -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r13316 r13318 192 192 self.assertEqual(len(results), 1) 193 193 released = self.app['hostels'].releaseExpiredAllocations(7) 194 self.assertEqual(released, 0)194 self.assertEqual(released, []) 195 195 delta = timedelta(days=10) 196 196 bedticket.booking_date = datetime.utcnow() - delta 197 197 released = self.app['hostels'].releaseExpiredAllocations(7) 198 self.assertEqual(released, 1) 198 self.assertEqual(len(released), 1) 199 self.assertEqual(released, ['hall_block_room_bed (K1000000)']) 199 200 results = cat.searchResults(owner=(self.student_id, self.student_id)) 200 201 self.assertEqual(len(results), 0) … … 204 205 self.app['hostels']['hall-x']['hall_block_room_bed'].owner, 205 206 NOT_OCCUPIED) 207 # Releasing is logged. 208 logcontent = open(self.logfile).read() 209 self.assertTrue( 210 'hostels.container.HostelsContainer - hostels - ' 211 'released: hall_block_room_bed (K1000000)' 212 in logcontent) 206 213 return 207 214
Note: See TracChangeset for help on using the changeset viewer.