Patched part divider, forgot to check if the exam had field intro

This commit is contained in:
Carlos Mesquita
2024-08-20 20:14:42 +01:00
parent 2e699d7e25
commit 2cd025b118

View File

@@ -70,7 +70,8 @@ export default function Level({ exam, showSolutions = false, onFinish, editing =
userSolutions: userSolutions.find((x) => x.exercise === exercise.id)?.solutions || [], userSolutions: userSolutions.find((x) => x.exercise === exercise.id)?.solutions || [],
}; };
if (exam.shuffle && exercise.type === "multipleChoice") { if (exam.shuffle && exercise.type === "multipleChoice" && !showSolutions) {
console.log("Shuffling");
const exerciseShuffles = userSolutions[exerciseIndex].shuffleMaps; const exerciseShuffles = userSolutions[exerciseIndex].shuffleMaps;
if (exerciseShuffles && exerciseShuffles.length == 0) { if (exerciseShuffles && exerciseShuffles.length == 0) {
const newShuffleMaps: ShuffleMap[] = []; const newShuffleMaps: ShuffleMap[] = [];
@@ -112,7 +113,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing =
return question; return question;
}); });
} }
} else if (exam.shuffle && exercise.type === "fillBlanks" && typeCheckWordsMC(exercise.words)) { } else if (exam.shuffle && exercise.type === "fillBlanks" && typeCheckWordsMC(exercise.words) && !showSolutions) {
if (shuffleMaps.length === 0 && !showSolutions) { if (shuffleMaps.length === 0 && !showSolutions) {
const newShuffleMaps: ShuffleMap[] = []; const newShuffleMaps: ShuffleMap[] = [];
@@ -194,7 +195,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing =
} }
if (partIndex + 1 < exam.parts.length && !hasExamEnded && (showQuestionsModal || showSolutions)) { if (partIndex + 1 < exam.parts.length && !hasExamEnded && (showQuestionsModal || showSolutions)) {
if (!showSolutions) { if (!showSolutions && exam.parts[0].intro) {
setShowPartDivider(true); setShowPartDivider(true);
setBgColor(levelBgColor); setBgColor(levelBgColor);
} }
@@ -353,7 +354,7 @@ export default function Level({ exam, showSolutions = false, onFinish, editing =
!(partIndex === 0 && storeQuestionIndex === 0 && showPartDivider) && !(partIndex === 0 && storeQuestionIndex === 0 && showPartDivider) &&
<Timer minTimer={exam.minTimer} disableTimer={showSolutions} standalone={true} /> <Timer minTimer={exam.minTimer} disableTimer={showSolutions} standalone={true} />
} }
{showPartDivider ? <PartDivider part={exam.parts[partIndex]} partIndex={partIndex} onNext={() => { setShowPartDivider(false); setBgColor("bg-white") }} /> : ( {exam.parts[0].intro && showPartDivider ? <PartDivider part={exam.parts[partIndex]} partIndex={partIndex} onNext={() => { setShowPartDivider(false); setBgColor("bg-white") }} /> : (
<> <>
<ModuleTitle <ModuleTitle
partLabel={partLabel()} partLabel={partLabel()}