From c48c6e5bcac4f725a6dffbb14c6513d648214033 Mon Sep 17 00:00:00 2001 From: serversdown Date: Fri, 15 May 2026 02:28:52 +0000 Subject: [PATCH] fix(assignments): delete_assignment used wrong column name on MonitoringSession The safety check that refuses to delete assignments with real recording history referenced MonitoringSession.start_time, but the actual column is MonitoringSession.started_at. Every DELETE call to /assignments/{id} crashed with AttributeError before doing anything. Now uses started_at correctly. Verified end-to-end on dev. Co-Authored-By: Claude Opus 4.7 --- backend/routers/project_locations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/routers/project_locations.py b/backend/routers/project_locations.py index 02003d6..7059192 100644 --- a/backend/routers/project_locations.py +++ b/backend/routers/project_locations.py @@ -874,8 +874,8 @@ async def delete_assignment( and_( MonitoringSession.location_id == assignment.location_id, MonitoringSession.unit_id == assignment.unit_id, - MonitoringSession.start_time >= window_start, - MonitoringSession.start_time <= window_end, + MonitoringSession.started_at >= window_start, + MonitoringSession.started_at <= window_end, ) ).count()