mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-09 03:38:18 +00:00
Refactor exam form handling to support mixed paper types and update related interfaces
This commit is contained in:
@@ -117,13 +117,18 @@ export function ExamDetailPage() {
|
||||
|
||||
// Only approved bank items may go on a paper (US-EXAM-003), so the picker
|
||||
// must not offer drafts or retired questions either.
|
||||
//
|
||||
// BOTH describes a mixed paper — a question itself is never "BOTH" (see
|
||||
// QuestionForm), so an equality check against it would match nothing and
|
||||
// silently offer zero questions. Same skip-condition as the backend's own
|
||||
// random draw (ExamService.selectRandomQuestions).
|
||||
const eligibleQuestions = useMemo(() => {
|
||||
if (!exam) return [];
|
||||
return allQuestions
|
||||
.filter(
|
||||
(q) =>
|
||||
q.certificationId === exam.certificationId &&
|
||||
q.form === exam.form &&
|
||||
(exam.form === 'BOTH' || q.form === exam.form) &&
|
||||
q.status === 'APPROVED',
|
||||
)
|
||||
.map((q) => ({ id: q.id, title: q.title, form: q.form, points: q.points }));
|
||||
|
||||
Reference in New Issue
Block a user