def chair_update(photon_id,occupation_status): """ MAY BE DEPRECATED occupation_status: 0 for empty, 1 for full """ #need to emit to the client that we got a chair_update chair = Chair.query.filter_by(photon_id=photon_id).first() if not (chair): return "Failed" chair.occupied = True if occupation_status == "1" else False chair.last_changed = datetime.utcnow() db.session.commit() socketio.emit("chair update",{"name": chair.name}) return "Success"
def chair_update(photon_id,occupation_status): """ occupation_status: 0 for empty, 1 for full """ #need to emit to the client that we got a chair_update chair = Chair.query.filter_by(photon_id=photon_id).first() if not (chair): return "Failed" chair.occupied = True if occupation_status == "1" else False chair.last_changed = datetime.utcnow() db.session.commit() socketio.emit("chair update", { "photon_id": chair.photon_id, "to": occupation_status, "name": chair.name, "building": chair.table.room.building.name, "room": chair.table.room.name }) return "Success"