Merged in ENCOA-139_ReleaseBug (pull request #87)

ENCOA-139 Release Improvements
This commit is contained in:
João Ramos
2024-09-03 15:47:17 +00:00
committed by Tiago Ribeiro
5 changed files with 215 additions and 278 deletions

View File

@@ -214,7 +214,7 @@ export default function ExamPage({page, user}: Props) {
if (selectedModules.length > 0 && exams.length > 0 && moduleIndex < selectedModules.length) {
const nextExam = exams[moduleIndex];
if (partIndex === -1 && nextExam.module !== "listening") setPartIndex(0);
if (partIndex === -1 && nextExam?.module !== "listening") setPartIndex(0);
if (exerciseIndex === -1 && !["reading", "listening"].includes(nextExam?.module)) setExerciseIndex(0);
setExam(nextExam ? updateExamWithUserSolutions(nextExam) : undefined);
}

View File

@@ -123,6 +123,7 @@ async function POST(req: NextApiRequest, res: NextApiResponse) {
endDate: string;
variant?: Variant;
instructorGender?: InstructorGender;
released: boolean;
};
const exams: ExamWithUser[] = !!examIDs
@@ -140,7 +141,6 @@ async function POST(req: NextApiRequest, res: NextApiResponse) {
results: [],
exams,
instructorGender,
released: false,
...body,
});