From 7ce8c50179c515b38221d073e6107b6e1cd1750c Mon Sep 17 00:00:00 2001 From: GotthardG <51994228+GotthardG@users.noreply.github.com> Date: Fri, 31 Jan 2025 12:58:15 +0100 Subject: [PATCH] Fix timestamp method and loop variable order issues Updated `datetime.utcnow()` to `datetime.now()` to align with local timezone handling. Corrected the order of unpacked variables in the loop to match the structure of `pucks_with_latest_events`. --- backend/app/routers/puck.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/routers/puck.py b/backend/app/routers/puck.py index 9418704..a009fcf 100644 --- a/backend/app/routers/puck.py +++ b/backend/app/routers/puck.py @@ -115,7 +115,7 @@ async def set_tell_positions( puck_id=puck.id, tell_position=None, event_type="puck_removed", # Event type set to "puck_removed" - timestamp=datetime.utcnow(), + timestamp=datetime.now(), ) db.add(remove_event) @@ -467,7 +467,7 @@ async def get_pucks_by_slot(slot_identifier: str, db: Session = Depends(get_db)) # Prepare the final response results = [] - for puck, event_type, dewar, tell_position in pucks_with_latest_events: + for puck, event_type, tell_position, dewar in pucks_with_latest_events: logger.debug( f"Puck ID: {puck.id}, Name: {puck.puck_name}, Event Type: {event_type}, " f"Tell Position: {tell_position}"