update(checkin tool web): update status when status from server and tool are wrong
This commit is contained in:
parent
2f1e26d3f6
commit
a5fa0cbcda
|
|
@ -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:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue