Previous commit solved completion but messed up question modal, patched that and added the condition to show the submission modal when all questions are awnswered
This commit is contained in:
@@ -81,9 +81,7 @@ export default function MultipleChoice({ id, prompt, type, questions, userSoluti
|
||||
shuffles,
|
||||
hasExamEnded,
|
||||
partIndex,
|
||||
userSolutions: storeUserSolutions,
|
||||
setQuestionIndex,
|
||||
setUserSolutions,
|
||||
setCurrentSolution
|
||||
} = useExamStore((state) => state);
|
||||
|
||||
@@ -91,14 +89,6 @@ export default function MultipleChoice({ id, prompt, type, questions, userSoluti
|
||||
|
||||
const scrollToTop = () => Array.from(document.getElementsByTagName("body")).forEach((body) => body.scrollTo(0, 0));
|
||||
|
||||
useEffect(() => {
|
||||
setUserSolutions(
|
||||
[...storeUserSolutions.filter((x) => x.exercise !== id), {
|
||||
exercise: id, solutions: answers, score: calculateScore(), type
|
||||
}]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [answers]);
|
||||
|
||||
useEffect(() => {
|
||||
if (hasExamEnded) onNext({ exercise: id, solutions: answers, score: calculateScore(), type });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -112,7 +102,7 @@ export default function MultipleChoice({ id, prompt, type, questions, userSoluti
|
||||
useEffect(() => {
|
||||
setCurrentSolution({ exercise: id, solutions: answers, score: calculateScore(), type, shuffleMaps: shuffleMaps });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [answers])
|
||||
}, [answers, setAnswers])
|
||||
|
||||
const getShuffledSolution = (originalSolution: string, questionShuffleMap: ShuffleMap) => {
|
||||
for (const [newPosition, originalPosition] of Object.entries(questionShuffleMap.map)) {
|
||||
|
||||
Reference in New Issue
Block a user