forge
Explore
Log in

Don't you dare go Hollow

✨ implement exam link component and enhance exam-related UI features

Browse files at this commit

3f5a474a8a922bf1da31586337c844a8869a6a13Burak BoduroğluParent: ee0b44d
  • feat
    • ✨ implement exam link component and enhance exam-related UI features
Show full message
feat: ✨ implement exam link component and enhance exam-related UI features
docs/backend-ui-alignment-plan.mdmodified+7 -2
@@ -28,12 +28,16 @@ This plan covers the remaining backend features that need simple, low-complexity
2828 - Run `bun run build` before every commit.
2929 - Commit messages must follow repository rules and require explicit user approval.
3030
31+## Status
32+
33+- Commit 1 complete in UI: live monitor shows absent count/status, attempt usage, and left timestamp; exam room summary shows attempt usage and left timestamp.
34+- Commit 2 complete in UI: report card types accept grade-band fields and marks show `mark / grade` when backend sends labels.
35+- Commits 3-7 remain.
36+
3137 ## Remaining Commit Order
3238
3339 | Commit | Scope | Priority |
3440 | --- | --- | --- |
35-| 1 | Live monitor + exam room attempt fields | High |
36-| 2 | Marks grade-band labels | High |
3741 | 3 | Settings management page | High |
3842 | 4 | Terms API + course term select | Medium |
3943 | 5 | Course sessions + roll call | Medium |
@@ -51,6 +55,7 @@ Expose backend attempt, no-show, and room-left fields without making the UI comp
5155 - `LiveRosterEntry.status`: includes `absent`.
5256 - `LiveRosterEntry.attempt`.
5357 - `LiveRosterEntry.attempts_used`.
58+- `LiveRosterEntry.max_attempts`.
5459 - `LiveRosterEntry.left_at`.
5560 - `LiveMonitor.counts.absent`.
5661 - `ExamAttempt.attempt`.
src/api/types.tsmodified+4 -0
@@ -149,6 +149,7 @@ export type MarkEntry = {
149149 type_weight?: number | null;
150150 exam_type_weight?: number | null;
151151 mark: number;
152+ grade?: string | null;
152153 graded_by: string;
153154 };
154155
@@ -156,12 +157,14 @@ export type CourseMarks = {
156157 course: Course;
157158 results: MarkEntry[];
158159 average: number | null;
160+ average_grade?: string | null;
159161 };
160162
161163 export type MarksReport = {
162164 user: string;
163165 courses: CourseMarks[];
164166 overall_average: number | null;
167+ overall_grade?: string | null;
165168 };
166169
167170 export type ExamStatistics = {
@@ -195,6 +198,7 @@ export type LiveRosterEntry = {
195198 status: AttemptStatus | "not_started" | "absent";
196199 attempt?: number | null;
197200 attempts_used?: number | null;
201+ max_attempts?: number | null;
198202 deadline: number | null;
199203 remaining_ms: number | null;
200204 left_at?: number | null;
src/components/exams/exam-card.tsxmodified+3 -3
@@ -1,7 +1,7 @@
11 import { Show } from "solid-js";
2-import { Link } from "@tanstack/solid-router";
32 import type { Exam } from "@/api/types";
43 import { Badge } from "@/components/ui/badge";
4+import { ExamLink } from "@/components/exams/exam-link";
55 import { cn } from "@/lib/cn";
66 import { examKindLabel } from "@/lib/exam-labels";
77 import { examWeight } from "@/lib/exam-weight";
@@ -52,7 +52,7 @@ export function ExamCard(props: { exam: Exam; courseTitle?: string; now?: number
5252 };
5353
5454 return (
55- <Link to="/exams/$id" params={{ id: props.exam.id }} class="group block h-full">
55+ <ExamLink examId={props.exam.id} class="group block h-full">
5656 <article class="surface-card relative flex h-full min-h-52 flex-col overflow-hidden transition-all group-hover:-translate-y-0.5 group-hover:border-rose-500/30 group-hover:shadow-sm">
5757 <div class="absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-rose-500/70 via-amber-400/50 to-transparent" />
5858 <div class="flex flex-1 flex-col p-4">
@@ -111,6 +111,6 @@ export function ExamCard(props: { exam: Exam; courseTitle?: string; now?: number
111111 </dl>
112112 </div>
113113 </article>
114- </Link>
114+ </ExamLink>
115115 );
116116 }
src/components/exams/exam-form.tsxmodified+32 -3
@@ -29,6 +29,11 @@ function timeInputFromMs(ms: number | null | undefined): string {
2929 return `${pad(d.getHours())}:${pad(d.getMinutes())}`;
3030 }
3131
32+function durationMinutesFromMs(ms: number | null | undefined): string {
33+ if (ms == null) return "";
34+ return String(Math.round(ms / 60000));
35+}
36+
3237 function scheduleInputToMs(date: string, time: string): number | null {
3338 const dateMatch = date.trim().match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
3439 const timeMatch = time.trim().match(/^(\d{2}):(\d{2})$/);
@@ -83,6 +88,7 @@ export function ExamForm(props: {
8388 const [startsTime, setStartsTime] = createSignal(timeInputFromMs(props.initial?.starts_at));
8489 const [endsDate, setEndsDate] = createSignal(dateInputFromMs(props.initial?.ends_at));
8590 const [endsTime, setEndsTime] = createSignal(timeInputFromMs(props.initial?.ends_at));
91+ const [durationMinutes, setDurationMinutes] = createSignal(durationMinutesFromMs(props.initial?.duration_ms));
8692 const [error, setError] = createSignal("");
8793 const [pending, setPending] = createSignal(false);
8894 const [confirmOpen, setConfirmOpen] = createSignal(false);
@@ -100,7 +106,7 @@ export function ExamForm(props: {
100106 if (names.length > 0 && !names.includes(kind())) setKind(names[0]);
101107 });
102108
103- const validate = (starts: number | null, ends: number | null): string | null => {
109+ const validate = (starts: number | null, ends: number | null, duration: number | null): string | null => {
104110 const value = title().trim();
105111 if (!value) return t("form.titleRequired");
106112 if (value.length > 200) return t("form.titleMax");
@@ -110,6 +116,11 @@ export function ExamForm(props: {
110116 if (mode() === "sync" || mode() === "async") {
111117 if (starts == null || ends == null) return t("exams.scheduleRequired");
112118 if (ends <= starts) return t("form.timeOrder");
119+ if (!isEdit() && (starts < Date.now() || ends < Date.now())) return t("form.timePast");
120+ }
121+ if (mode() === "async") {
122+ if (duration == null) return t("exams.durationRequired");
123+ if (duration < 60000 || duration > 86400000) return t("exams.durationRange");
113124 }
114125 return null;
115126 };
@@ -130,6 +141,7 @@ export function ExamForm(props: {
130141 setStartsTime("");
131142 setEndsDate("");
132143 setEndsTime("");
144+ setDurationMinutes("");
133145 }
134146 } catch (err) {
135147 setError(formatApiError(err));
@@ -143,8 +155,9 @@ export function ExamForm(props: {
143155 const hasWindow = mode() === "sync" || mode() === "async";
144156 const starts_at = hasWindow ? scheduleInputToMs(startsDate(), startsTime()) : null;
145157 const ends_at = hasWindow ? scheduleInputToMs(endsDate(), endsTime()) : null;
146- const duration_ms = mode() === "async" && starts_at != null && ends_at != null ? ends_at - starts_at : null;
147- const v = validate(starts_at, ends_at);
158+ const durationValue = Number(durationMinutes());
159+ const duration_ms = mode() === "async" && Number.isFinite(durationValue) ? durationValue * 60000 : null;
160+ const v = validate(starts_at, ends_at, duration_ms);
148161 if (v) {
149162 setError(v);
150163 return;
@@ -300,6 +313,22 @@ export function ExamForm(props: {
300313 </div>
301314 </div>
302315 </Show>
316+ <Show when={mode() === "async"}>
317+ <div class="space-y-1.5">
318+ <Label for="exam-duration-minutes">{t("exams.durationMinutes")}</Label>
319+ <Input
320+ id="exam-duration-minutes"
321+ class="rounded-sm"
322+ type="number"
323+ min={1}
324+ max={1440}
325+ step={1}
326+ value={durationMinutes()}
327+ required
328+ onInput={(e) => setDurationMinutes(e.currentTarget.value)}
329+ />
330+ </div>
331+ </Show>
303332 {error() && <p class="text-sm text-destructive">{error()}</p>}
304333 <div class="flex flex-wrap items-center gap-2">
305334 <Button type="submit" disabled={pending()}>
src/components/exams/exam-link.tsxadded+19 -0
@@ -0,0 +1,19 @@
1+import type { ComponentProps, ParentProps } from "solid-js";
2+import { splitProps } from "solid-js";
3+
4+type ExamLinkProps = ParentProps<
5+ Omit<ComponentProps<"a">, "href"> & {
6+ examId: string;
7+ }
8+>;
9+
10+export function ExamLink(props: ExamLinkProps) {
11+ const [local, rest] = splitProps(props, ["children", "examId"]);
12+ const href = () => `/exams/${encodeURIComponent(local.examId)}`;
13+
14+ return (
15+ <a {...rest} href={href()}>
16+ {local.children}
17+ </a>
18+ );
19+}
src/components/exams/exam-room-ws.tsxmodified+16 -0
@@ -358,12 +358,22 @@ function AttemptSummaryWS(props: { attempt: ExamAttempt; remainingMs: number | n
358358 if (props.wsState === "connected") return t("ws.connected");
359359 return t("ws.disconnected");
360360 };
361+ const attemptLabel = () => {
362+ if (props.attempt.attempts_used != null && props.attempt.max_attempts != null) return `${props.attempt.attempts_used} / ${props.attempt.max_attempts}`;
363+ if (props.attempt.attempt != null) return String(props.attempt.attempt);
364+ if (props.attempt.attempts_used != null) return String(props.attempt.attempts_used);
365+ return "—";
366+ };
361367 return (
362368 <div class="grid auto-rows-fr gap-3 text-sm sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-6">
363369 <div class="h-full rounded-lg border bg-background/60 p-3">
364370 <p class="text-xs text-muted-foreground">{t("attempt.status")}</p>
365371 <p class="mt-1 font-medium">{statusLabel()}</p>
366372 </div>
373+ <div class="h-full rounded-lg border bg-background/60 p-3">
374+ <p class="text-xs text-muted-foreground">{t("attempt.attempt")}</p>
375+ <p class="mt-1 font-medium tabular-nums">{attemptLabel()}</p>
376+ </div>
367377 <div class={remainingWarn() ? "h-full rounded-lg border border-amber-500/40 bg-amber-500/10 p-3" : "h-full rounded-lg border bg-background/60 p-3"}>
368378 <p class="text-xs text-muted-foreground">{t("attempt.remaining")}</p>
369379 <p class="mt-1 font-mono text-lg font-semibold tabular-nums">{formatRemaining(props.remainingMs)}</p>
@@ -396,6 +406,12 @@ function AttemptSummaryWS(props: { attempt: ExamAttempt; remainingMs: number | n
396406 <p class="mt-1 font-medium">{props.attempt.mark}</p>
397407 </div>
398408 </Show>
409+ <Show when={props.attempt.left_at != null}>
410+ <div class="h-full rounded-lg border border-amber-500/40 bg-amber-500/10 p-3">
411+ <p class="text-xs text-muted-foreground">{t("attempt.left")}</p>
412+ <p class="mt-1 font-medium">{formatDateTime(props.attempt.left_at, locale())}</p>
413+ </div>
414+ </Show>
399415 </div>
400416 );
401417 }
src/components/marks/marks-report-view.tsxmodified+11 -5
@@ -2,6 +2,7 @@ import { For, Show } from "solid-js";
22 import { Link } from "@tanstack/solid-router";
33 import type { MarksReport } from "@/api/types";
44 import { Badge } from "@/components/ui/badge";
5+import { ExamLink } from "@/components/exams/exam-link";
56 import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
67 import { examKindLabel } from "@/lib/exam-labels";
78 import { examWeight } from "@/lib/exam-weight";
@@ -9,6 +10,11 @@ import { useT } from "@/stores/preferences-context";
910
1011 const round = (n: number) => (Math.round(n * 100) / 100).toString();
1112
13+function markWithGrade(mark: number | null, grade?: string | null) {
14+ if (mark == null) return grade ?? "—";
15+ return grade ? `${round(mark)} / ${grade}` : round(mark);
16+}
17+
1218 export function MarksReportView(props: { report: MarksReport }) {
1319 const t = useT();
1420 return (
@@ -24,7 +30,7 @@ export function MarksReportView(props: { report: MarksReport }) {
2430 <div class="surface-card flex flex-wrap items-center justify-between gap-3 p-5">
2531 <span class="text-sm font-medium text-muted-foreground">{t("marks.overall")}</span>
2632 <p class="font-display text-3xl font-semibold tabular-nums">
27- {props.report.overall_average == null ? "—" : round(props.report.overall_average)}
33+ {markWithGrade(props.report.overall_average, props.report.overall_grade)}
2834 <Show when={props.report.overall_average != null}>
2935 <span class="text-base font-medium text-muted-foreground"> / 100</span>
3036 </Show>
@@ -41,7 +47,7 @@ export function MarksReportView(props: { report: MarksReport }) {
4147 </Link>
4248 </h3>
4349 <Badge variant="secondary" class="rounded-full px-3 py-1" title={t("marks.courseAvg")}>
44- {block.average == null ? "—" : round(block.average)}
50+ {markWithGrade(block.average, block.average_grade)}
4551 </Badge>
4652 </header>
4753
@@ -68,9 +74,9 @@ export function MarksReportView(props: { report: MarksReport }) {
6874 {(entry) => (
6975 <TableRow>
7076 <TableCell>
71- <Link to="/exams/$id" params={{ id: entry.exam }} class="font-medium hover:underline">
77+ <ExamLink examId={entry.exam} class="font-medium hover:underline">
7278 {entry.title}
73- </Link>
79+ </ExamLink>
7480 </TableCell>
7581 <TableCell>
7682 <Badge variant="outline" class="rounded-full capitalize">
@@ -78,7 +84,7 @@ export function MarksReportView(props: { report: MarksReport }) {
7884 </Badge>
7985 </TableCell>
8086 <TableCell class="tabular-nums">{examWeight(entry) ?? "—"}</TableCell>
81- <TableCell class="font-semibold tabular-nums">{entry.mark}</TableCell>
87+ <TableCell class="font-semibold tabular-nums">{markWithGrade(entry.mark, entry.grade)}</TableCell>
8288 </TableRow>
8389 )}
8490 </For>
src/i18n/messages.tsmodified+12 -0
@@ -206,6 +206,8 @@ export type MessageKey =
206206 | "attempt.finish"
207207 | "attempt.status"
208208 | "attempt.remaining"
209+ | "attempt.attempt"
210+ | "attempt.left"
209211 | "attempt.progress"
210212 | "attempt.deadline"
211213 | "attempt.notStarted"
@@ -219,6 +221,7 @@ export type MessageKey =
219221 | "attempt.expired"
220222 | "attempt.closed"
221223 | "attempt.inProgress"
224+ | "attempt.absent"
222225 | "exams.helpTitle"
223226 | "exams.helpBody"
224227 | "admin.title"
@@ -266,6 +269,7 @@ export type MessageKey =
266269 | "form.contentMax"
267270 | "form.descriptionMax"
268271 | "form.timeOrder"
272+ | "form.timePast"
269273 | "form.weightRange"
270274 | "form.markRange"
271275 | "events.markedBy"
@@ -568,6 +572,8 @@ const en: Dict = {
568572 "attempt.finish": "Finish exam",
569573 "attempt.status": "Status",
570574 "attempt.remaining": "Remaining",
575+ "attempt.attempt": "Attempt",
576+ "attempt.left": "Left",
571577 "attempt.progress": "Progress",
572578 "attempt.deadline": "Deadline",
573579 "attempt.notStarted": "Start the scheduled exam to see questions.",
@@ -581,6 +587,7 @@ const en: Dict = {
581587 "attempt.expired": "Expired",
582588 "attempt.closed": "This attempt is closed. Answers are read-only.",
583589 "attempt.inProgress": "In progress",
590+ "attempt.absent": "No-show",
584591 "exams.helpTitle": "About exams",
585592 "exams.helpBody":
586593 "Exams belong to a course. Teachers add them from the course page with a kind; weighting is defined by the exam kind. Students only see their own mark (or “not graded yet”). Weighted averages appear on the report card.",
@@ -639,6 +646,7 @@ const en: Dict = {
639646 "form.contentMax": "Content must be at most 10 000 characters",
640647 "form.descriptionMax": "Description must be at most 2 000 characters",
641648 "form.timeOrder": "End time must be on or after start time",
649+ "form.timePast": "Start and end times must be in the future",
642650 "form.weightRange": "Weight must be an integer from 1 to 100",
643651 "form.markRange": "Mark must be an integer from 0 to 100",
644652 "events.markedBy": "Marked by",
@@ -940,6 +948,8 @@ const tr: Dict = {
940948 "attempt.finish": "Sınavı bitir",
941949 "attempt.status": "Durum",
942950 "attempt.remaining": "Kalan süre",
951+ "attempt.attempt": "Deneme",
952+ "attempt.left": "Çıkış",
943953 "attempt.progress": "İlerleme",
944954 "attempt.deadline": "Bitiş zamanı",
945955 "attempt.notStarted": "Soruları görmek için zamanlı sınavı başlat.",
@@ -953,6 +963,7 @@ const tr: Dict = {
953963 "attempt.expired": "Süresi doldu",
954964 "attempt.closed": "Bu oturum kapalı. Cevaplar salt okunur.",
955965 "attempt.inProgress": "Devam ediyor",
966+ "attempt.absent": "Katılmadı",
956967 "exams.helpTitle": "Sınavlar hakkında",
957968 "exams.helpBody":
958969 "Sınavlar bir derse aittir. Öğretmenler ders sayfasından tür seçerek ekler; ağırlık sınav türünde tanımlıdır. Öğrenciler yalnızca kendi notunu görür. Ağırlıklı ortalamalar Karnem’dedir.",
@@ -1011,6 +1022,7 @@ const tr: Dict = {
10111022 "form.contentMax": "İçerik en fazla 10 000 karakter olmalı",
10121023 "form.descriptionMax": "Açıklama en fazla 2 000 karakter olmalı",
10131024 "form.timeOrder": "Bitiş, başlangıçtan önce olamaz",
1025+ "form.timePast": "Başlangıç ve bitiş gelecekte olmalı",
10141026 "form.weightRange": "Ağırlık 1–100 arası tam sayı olmalı",
10151027 "form.markRange": "Not 0–100 arası tam sayı olmalı",
10161028 "events.markedBy": "İşaretleyen",
src/pages/course-detail-page.tsxmodified+4 -4
@@ -10,6 +10,7 @@ import { patchCourseById } from "@/api/patchCourseById";
1010 import { postCourseEnrollment } from "@/api/postCourseEnrollment";
1111 import { postCourseExam } from "@/api/postCourseExam";
1212 import { formatApiError } from "@/api/client";
13+import { ExamLink } from "@/components/exams/exam-link";
1314 import { ExamForm } from "@/components/exams/exam-form";
1415 import { RouteGuard } from "@/components/layout/route-guard";
1516 import { PageHeader } from "@/components/layout/page-header";
@@ -341,9 +342,8 @@ function CourseDetailContent() {
341342 <For each={exams() ?? []}>
342343 {(exam) => (
343344 <li>
344- <Link
345- to="/exams/$id"
346- params={{ id: exam.id }}
345+ <ExamLink
346+ examId={exam.id}
347347 class="group flex items-start justify-between gap-3 rounded-lg border border-border/70 bg-background/60 px-4 py-3 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:bg-accent/35 hover:shadow-sm"
348348 >
349349 <div class="min-w-0 space-y-2">
@@ -362,7 +362,7 @@ function CourseDetailContent() {
362362 </Badge>
363363 </div>
364364 </div>
365- </Link>
365+ </ExamLink>
366366 </li>
367367 )}
368368 </For>
src/pages/dashboard-page.tsxmodified+4 -4
@@ -7,6 +7,7 @@ import { getMyMarks } from "@/api/getMyMarks";
77 import { getNotes } from "@/api/getNotes";
88 import { formatApiError } from "@/api/client";
99 import type { Event, Exam, Note } from "@/api/types";
10+import { ExamLink } from "@/components/exams/exam-link";
1011 import { RouteGuard } from "@/components/layout/route-guard";
1112 import { PageHeader } from "@/components/layout/page-header";
1213 import { Alert } from "@/components/ui/alert";
@@ -247,9 +248,8 @@ function DashboardContent() {
247248 <For each={previewExams()}>
248249 {(exam: Exam) => (
249250 <li>
250- <Link
251- to="/exams/$id"
252- params={{ id: exam.id }}
251+ <ExamLink
252+ examId={exam.id}
253253 class="flex min-h-[3.5rem] items-center justify-between gap-3 rounded-lg border border-border/70 bg-muted/25 px-3 py-2.5 transition-colors hover:border-primary/35 hover:bg-primary/[0.05]"
254254 >
255255 <div class="min-w-0">
@@ -261,7 +261,7 @@ function DashboardContent() {
261261 <Badge variant="outline" class="shrink-0 capitalize">
262262 {examKindLabel(String(exam.kind), t)}
263263 </Badge>
264- </Link>
264+ </ExamLink>
265265 </li>
266266 )}
267267 </For>
src/pages/live-monitor-page.tsxmodified+24 -6
@@ -19,7 +19,7 @@ import { createNow } from "@/lib/create-now";
1919 import { formatDateTime } from "@/lib/format";
2020 import { cn } from "@/lib/cn";
2121
22-type SortKey = "username" | "status" | "progress" | "remaining" | "activity" | "mark";
22+type SortKey = "username" | "status" | "attempt" | "progress" | "remaining" | "left" | "mark";
2323
2424 const PAGE_SIZE = 10;
2525
@@ -36,6 +36,7 @@ const STATUS_KEY: Record<string, MessageKey> = {
3636 in_progress: "attempt.inProgress",
3737 submitted: "attempt.submitted",
3838 expired: "attempt.expired",
39+ absent: "attempt.absent",
3940 };
4041
4142 function labelFromStatus(status: string, t: (key: MessageKey) => string): string {
@@ -73,8 +74,9 @@ function liveRosterName(entry: LiveRosterEntry, fallback: string): string {
7374 }
7475
7576 function remainingMinutesLabel(entry: LiveRosterEntry): string {
76- const remaining = entry.remaining_ms ?? 0;
77+ const remaining = entry.remaining_ms;
7778 if (entry.status !== "in_progress") return "—";
79+ if (remaining == null) return "—";
7880 if (remaining > 0) return `${Math.ceil(remaining / 60000)}dk`;
7981 return "<1dk";
8082 }
@@ -84,6 +86,13 @@ function isLowRemaining(entry: LiveRosterEntry): boolean {
8486 return entry.status === "in_progress" && remaining <= 5 * 60 * 1000;
8587 }
8688
89+function attemptLabel(entry: LiveRosterEntry): string {
90+ if (entry.attempts_used != null && entry.max_attempts != null) return `${entry.attempts_used} / ${entry.max_attempts}`;
91+ if (entry.attempt != null) return String(entry.attempt);
92+ if (entry.attempts_used != null) return String(entry.attempts_used);
93+ return "—";
94+}
95+
8796 function LiveMonitorContent() {
8897 const params = useParams({ from: "/exams/$id/live" });
8998 const t = useT();
@@ -185,9 +194,10 @@ function LiveMonitorContent() {
185194 const k = sortKey();
186195 if (k === "username") return liveRosterName(a, "").localeCompare(liveRosterName(b, ""));
187196 if (k === "status") return labelFromStatus(a.status, t).localeCompare(labelFromStatus(b.status, t));
197+ if (k === "attempt") return (a.attempts_used ?? a.attempt ?? 0) - (b.attempts_used ?? b.attempt ?? 0);
188198 if (k === "progress") return (a.answered ?? 0) - (b.answered ?? 0);
189199 if (k === "remaining") return (a.remaining_ms ?? 0) - (b.remaining_ms ?? 0);
190- if (k === "activity") return (a.last_activity ?? 0) - (b.last_activity ?? 0);
200+ if (k === "left") return (a.left_at ?? 0) - (b.left_at ?? 0);
191201 if (k === "mark") return (a.mark ?? -1) - (b.mark ?? -1);
192202 return 0;
193203 })();
@@ -237,7 +247,7 @@ function LiveMonitorContent() {
237247
238248 return (
239249 <>
240- <section class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
250+ <section class="grid gap-3 sm:grid-cols-2 lg:grid-cols-5">
241251 <div class="surface-card bg-card/80 p-4">
242252 <p class="text-xs text-muted-foreground">{t("exams.notStarted")}</p>
243253 <p class="mt-1 font-display text-2xl font-semibold tabular-nums">{counts.not_started}</p>
@@ -254,6 +264,10 @@ function LiveMonitorContent() {
254264 <p class="text-xs text-muted-foreground">{t("attempt.expired")}</p>
255265 <p class="mt-1 font-display text-2xl font-semibold tabular-nums">{counts.expired}</p>
256266 </div>
267+ <div class="surface-card bg-card/80 p-4">
268+ <p class="text-xs text-muted-foreground">{t("attempt.absent")}</p>
269+ <p class="mt-1 font-display text-2xl font-semibold tabular-nums">{counts.absent ?? 0}</p>
270+ </div>
257271 </section>
258272
259273 <section class="surface-card space-y-4 p-5">
@@ -280,9 +294,10 @@ function LiveMonitorContent() {
280294 <TableRow>
281295 <SortHead label={t("admin.username")} sortKey="username" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-left" />
282296 <SortHead label={t("attempt.status")} sortKey="status" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-center" />
297+ <SortHead label={t("attempt.attempt")} sortKey="attempt" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-center" />
283298 <SortHead label={t("attempt.progress")} sortKey="progress" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-center" />
284299 <SortHead label={t("attempt.remaining")} sortKey="remaining" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-center" />
285- <SortHead label={t("exams.lastActivity")} sortKey="activity" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-center" />
300+ <SortHead label={t("attempt.left")} sortKey="left" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-center" />
286301 <SortHead label={t("marks.mark")} sortKey="mark" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-center" />
287302 </TableRow>
288303 </TableHeader>
@@ -305,6 +320,9 @@ function LiveMonitorContent() {
305320 {labelFromStatus(entry.status, t)}
306321 </Badge>
307322 </TableCell>
323+ <TableCell class="text-center tabular-nums">
324+ {attemptLabel(entry)}
325+ </TableCell>
308326 <TableCell class="min-w-32 tabular-nums">
309327 <div class="flex items-center justify-center gap-2">
310328 <span>{entry.answered}/{m.question_count}</span>
@@ -319,7 +337,7 @@ function LiveMonitorContent() {
319337 </span>
320338 </TableCell>
321339 <TableCell class="text-center text-xs">
322- {entry.last_activity ? formatDateTime(entry.last_activity, locale()) : "—"}
340+ {entry.left_at ? formatDateTime(entry.left_at, locale()) : "—"}
323341 </TableCell>
324342 <TableCell class="text-center font-semibold tabular-nums">
325343 {entry.mark != null ? entry.mark : "—"}