From a5fa0cbcdaa767d8b849f0693b1a48cd00c0d31c Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 13 May 2026 10:24:34 +0700 Subject: [PATCH] update(checkin tool web): update status when status from server and tool are wrong --- TrackingToolWeb/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TrackingToolWeb/main.py b/TrackingToolWeb/main.py index 9c47621..4e3be09 100644 --- a/TrackingToolWeb/main.py +++ b/TrackingToolWeb/main.py @@ -341,7 +341,7 @@ async def checkin(background_tasks: BackgroundTasks, file: UploadFile = File(... ).fetchone() status = "check out" if last_log and last_log.status == "check in" else "check in" - db.execute( + insert_result = db.execute( text(""" INSERT INTO checkin_logs (student_id, time, camera_id, status) VALUES (:student_id, :time, :camera_id, :status) @@ -353,8 +353,8 @@ async def checkin(background_tasks: BackgroundTasks, file: UploadFile = File(... "status": status } ) + log_id = insert_result.lastrowid db.commit() - log_id = db.execute(text("SELECT LAST_INSERT_ID()")).scalar() def _sync_to_ms(name: str, time_string: str, img_data: bytes, local_status: str, checkin_log_id: int): try: