added more informations in the slot summary

This commit is contained in:
GotthardG 2024-11-28 12:24:57 +01:00
parent 8208a7c4ec
commit 7d5e86932d
2 changed files with 13 additions and 0 deletions

View File

@ -170,6 +170,13 @@ async def get_all_slots(db: Session = Depends(get_db)):
beamlineLocation = associated_slot.label if associated_slot else None beamlineLocation = associated_slot.label if associated_slot else None
at_beamline = last_event.event_type == "beamline" 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( slot_data = SlotSchema(
id=slot.id, id=slot.id,
qr_code=slot.qr_code, qr_code=slot.qr_code,
@ -184,6 +191,9 @@ async def get_all_slots(db: Session = Depends(get_db)):
retrieved=retrieved, retrieved=retrieved,
retrievedTimestamp=retrievedTimestamp, retrievedTimestamp=retrievedTimestamp,
beamlineLocation=beamlineLocation, 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 retrieved: {retrieved}")
logger.info(f"Dewar at: {beamlineLocation}") logger.info(f"Dewar at: {beamlineLocation}")

View File

@ -289,6 +289,9 @@ class SlotSchema(BaseModel):
time_until_refill: Optional[int] time_until_refill: Optional[int]
at_beamline: Optional[bool] at_beamline: Optional[bool]
beamlineLocation: Optional[str] beamlineLocation: Optional[str]
shipment_name: Optional[str]
contact_person: Optional[str]
local_contact: Optional[str]
class Config: class Config:
from_attributes = True from_attributes = True