From 7d5e86932daf636466b2741665bff7c5674566db Mon Sep 17 00:00:00 2001 From: GotthardG <51994228+GotthardG@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:24:57 +0100 Subject: [PATCH] added more informations in the slot summary --- backend/app/routers/logistics.py | 10 ++++++++++ backend/app/schemas.py | 3 +++ 2 files changed, 13 insertions(+) diff --git a/backend/app/routers/logistics.py b/backend/app/routers/logistics.py index 72a3a98..d22d771 100644 --- a/backend/app/routers/logistics.py +++ b/backend/app/routers/logistics.py @@ -170,6 +170,13 @@ async def get_all_slots(db: Session = Depends(get_db)): beamlineLocation = associated_slot.label if associated_slot else None at_beamline = last_event.event_type == "beamline" + # Corrected the contact_person assignment + contact_person = None + if slot.dewar and slot.dewar.contact_person: + first_name = slot.dewar.contact_person.firstname + last_name = slot.dewar.contact_person.lastname + contact_person = f"{first_name} {last_name}" + slot_data = SlotSchema( id=slot.id, qr_code=slot.qr_code, @@ -184,6 +191,9 @@ async def get_all_slots(db: Session = Depends(get_db)): retrieved=retrieved, retrievedTimestamp=retrievedTimestamp, beamlineLocation=beamlineLocation, + shipment_name=slot.dewar.shipment.shipment_name if slot.dewar and slot.dewar.shipment else None, + contact_person=contact_person, + local_contact='local contact placeholder' ) logger.info(f"Dewar retrieved: {retrieved}") logger.info(f"Dewar at: {beamlineLocation}") diff --git a/backend/app/schemas.py b/backend/app/schemas.py index 7519ba5..af1df69 100644 --- a/backend/app/schemas.py +++ b/backend/app/schemas.py @@ -289,6 +289,9 @@ class SlotSchema(BaseModel): time_until_refill: Optional[int] at_beamline: Optional[bool] beamlineLocation: Optional[str] + shipment_name: Optional[str] + contact_person: Optional[str] + local_contact: Optional[str] class Config: from_attributes = True \ No newline at end of file