/* ================================================================== Online Submissions modal (online-typed tests) — teacher view. Replaces the Upload Sheets modal when test.type is set. Shows the roster with per-student submission status + auto-graded score, and opens a per-question detail report when "View report" is clicked. ================================================================== */ const OS_INFO = "var(--blue-solid)"; const OS_SUCCESS = "var(--green-solid)"; const OS_WARNING = "var(--amber-solid)"; const OS_DANGER = "var(--red-solid)"; const OnlineSubmissionsModal = ({ test, onClose }) => { const [roster, setRoster] = React.useState(null); const [detailFor, setDetailFor] = React.useState(null); // student row const [err, setErr] = React.useState(""); React.useEffect(() => { if (!test) return; let cancelled = false; window.AppApi.get(`/tests/${test.id}/students`) .then(r => { if (!cancelled) setRoster(r); }) .catch(e => { if (!cancelled) setErr(e?.message || "Failed to load roster"); }); return () => { cancelled = true; }; }, [test]); if (!test) return null; const submitted = (roster || []).filter(r => r.attempt?.status === "submitted" || r.attempt?.status === "reviewed").length; const inProgress = (roster || []).filter(r => r.attempt?.status === "in_progress").length; const notStarted = (roster || []).filter(r => !r.attempt).length; return (
| Roll no. | Name | Submission | Score | |
|---|---|---|---|---|
| {r.roll_no} | {r.name} | {score != null && max != null ? ( {score}/{max} ) : —} | ||
| No students enrolled in this test. | ||||
| Loading… | ||||
| {err} | ||||