Changeset 3772 for WAeUP_SRP/trunk/WAeUPTables.py
- Timestamp:
- 17 Nov 2008, 16:55:29 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTables.py
r3757 r3772 491 491 WAeUPTable.__init__(self, name) 492 492 493 def searchAndReserveBed(self, student_id,bed_type ): ###(493 def searchAndReserveBed(self, student_id,bed_type,random_order=False): ###( 494 494 logger = logging.getLogger('WAeUPTables.AccommodationTable.searchAndReserveBed') 495 495 records = self.evalAdvancedQuery(Eq('student',student_id)) … … 506 506 logger.info('no bed %s available for %s' % (bed_type,student_id)) 507 507 return -2,"no bed" 508 rec = records[0] 508 if random_order: 509 import random 510 bed_no = random.randint(0,len(records)-1) 511 else: 512 bed_no = 0 513 rec = records[bed_no] 509 514 self.modifyRecord(bed=rec.bed,student=student_id) 510 515 logger.info('%s booked bed %s' % (student_id,rec.bed))
Note: See TracChangeset for help on using the changeset viewer.