Changeset 3408 for WAeUP_SRP


Ignore:
Timestamp:
2 Apr 2008, 16:07:32 (17 years ago)
Author:
Henrik Bettermann
Message:

enable bed change for reserved beds

Location:
WAeUP_SRP/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTables.py

    r3406 r3408  
    497497        elif len(records) > 1:
    498498            logger.info('%s found more than one (reserved) bed' % (student_id))
    499             return -3,'more than one bed'           
     499            return -3,'more than one bed'
    500500        query = Eq('bed_type',bed_type) & Eq('student',NOT_OCCUPIED)
    501501        records = self.evalAdvancedQuery(query,sortSpecs=('sort_id','bed'))
    502502        if len(records) == 0:
    503             logger.info('No bed %s available for %s' % (bed_type,student_id))
     503            logger.info('no bed %s available for %s' % (bed_type,student_id))
    504504            return -2,"no bed"
    505505        rec = records[0]
  • WAeUP_SRP/base/skins/waeup_accommodation/change_bed.py

    r3406 r3408  
    4646            #break
    4747        elif res[0].bed_type.endswith("reserved"):
    48              logger.info('found reserved bed %s' % res[0].bed)
    49              pass       
    50         else:   
     48             logger.info("found reserved bed %s which won't be released" % res[0].bed)
     49             pass
     50        else:
    5151            allocated_bed = res[0]
    5252            if allocated_bed.bed_type == status:
     
    7474            acco_doc = info['acco_doc']
    7575            acco_doc.edit(mapping=d)
     76        if code > 0:
     77            psm = 'Bed changed!'
    7678            logger.info('Bed %s allocated to %s' % (bed,student_id))
    77             psm='Bed changed!'
    78             break
    79         logger.info('Bed change for %s failed, code = %s' % (student_id,code))
    80         psm='Bed change failed!'
     79        elif code == -1:
     80            psm = 'A reserved bed has been allocated.'
     81        elif code == -2:
     82            psm = 'No bed %s for %s available!' % (status,student_id)
     83        else:
     84            psm = 'Bed change failed!'
    8185        break
    8286    return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm))
Note: See TracChangeset for help on using the changeset viewer.