now associating a dewar to a slot with checks that it is not associated to another slot

This commit is contained in:
GotthardG 2024-11-19 15:04:47 +01:00
parent 98d6265ae1
commit cacf43b631

View File

@ -98,6 +98,12 @@ async def refill_dewar(qr_code: str, db: Session = Depends(get_db)):
# Process refill
dewar.last_refill = datetime.now()
# Calculate and update time until next refill
time_until_refill_seconds = calculate_time_until_refill(dewar.last_refill)
db.query(SlotModel).filter(SlotModel.dewar_unique_id == dewar.unique_id).update(
{'time_until_refill': time_until_refill_seconds})
new_event = LogisticsEventModel(
dewar_id=dewar.id, slot_id=None, # No specific slot, as it's a refill event
event_type="refill",