Merge pull request 'update(checkin tool web): update status when status from server and tool are wrong' (#160) from zelda.refactor-tracking-tool-web into master

Reviewed-on: #160
This commit is contained in:
zelda 2026-05-13 13:26:41 +10:00
commit 9d536955e4
1 changed files with 2 additions and 2 deletions

View File

@ -341,7 +341,7 @@ async def checkin(background_tasks: BackgroundTasks, file: UploadFile = File(...
).fetchone() ).fetchone()
status = "check out" if last_log and last_log.status == "check in" else "check in" status = "check out" if last_log and last_log.status == "check in" else "check in"
db.execute( insert_result = db.execute(
text(""" text("""
INSERT INTO checkin_logs (student_id, time, camera_id, status) INSERT INTO checkin_logs (student_id, time, camera_id, status)
VALUES (: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 "status": status
} }
) )
log_id = insert_result.lastrowid
db.commit() 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): def _sync_to_ms(name: str, time_string: str, img_data: bytes, local_status: str, checkin_log_id: int):
try: try: