Part and MC question grid jump to, has a bug on next going to refactor the whole thing
This commit is contained in:
@@ -81,7 +81,8 @@ export default function MultipleChoice({ id, prompt, type, questions, userSoluti
|
||||
hasExamEnded,
|
||||
userSolutions: storeUserSolutions,
|
||||
setQuestionIndex,
|
||||
setUserSolutions
|
||||
setUserSolutions,
|
||||
setCurrentSolution
|
||||
} = useExamStore((state) => state);
|
||||
|
||||
const shuffleMaps = shuffles.find((x) => x.exerciseID == id)?.shuffles;
|
||||
@@ -106,6 +107,11 @@ export default function MultipleChoice({ id, prompt, type, questions, userSoluti
|
||||
setAnswers((prev) => [...prev.filter((x) => x.question !== question.id), { option, question: question.id }]);
|
||||
};
|
||||
|
||||
useEffect(()=> {
|
||||
setCurrentSolution({ exercise: id, solutions: answers, score: calculateScore(), type, shuffleMaps: shuffleMaps });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [answers])
|
||||
|
||||
const getShuffledSolution = (originalSolution: string, questionShuffleMap: ShuffleMap) => {
|
||||
for (const [newPosition, originalPosition] of Object.entries(questionShuffleMap.map)) {
|
||||
if (originalPosition === originalSolution) {
|
||||
|
||||
Reference in New Issue
Block a user