From c8ee30d12a2fb043af3d6ce2ee40223ac30a2e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Wed, 15 Jul 2026 13:04:30 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20auto-expire=20exam=20atte?= =?UTF-8?q?mpt=20when=20countdown=20hits=200=20-=20set=20attempt=20status?= =?UTF-8?q?=20to=20expired=20+=20clear=20timer=20when=20remainingMs=20<=3D?= =?UTF-8?q?=200=20-=20close=20finish=20dialog=20on=20expiry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/exams/exam-room-ws.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/exams/exam-room-ws.tsx b/src/components/exams/exam-room-ws.tsx index dcb2d1a..c2caafb 100644 --- a/src/components/exams/exam-room-ws.tsx +++ b/src/components/exams/exam-room-ws.tsx @@ -229,7 +229,13 @@ export function ExamRoomWS(props: { exam: Exam }) { const startedAt = Date.now(); const initial = remaining; const timer = window.setInterval(() => { - setRemainingMs(Math.max(0, initial - (Date.now() - startedAt))); + const next = Math.max(0, initial - (Date.now() - startedAt)); + setRemainingMs(next); + if (next <= 0) { + setAttempt((prev) => (prev && prev.status === "in_progress" ? { ...prev, status: "expired" as any, remaining_ms: 0 } : prev)); + setFinishOpen(false); + window.clearInterval(timer); + } }, 1000); onCleanup(() => window.clearInterval(timer)); });