diff --git a/src/components/Exercises/FillBlanks.tsx b/src/components/Exercises/FillBlanks.tsx index 5644b959..1f529140 100644 --- a/src/components/Exercises/FillBlanks.tsx +++ b/src/components/Exercises/FillBlanks.tsx @@ -35,10 +35,10 @@ function WordsDrawer({words, isOpen, blankId, previouslySelectedWord, onCancel,
{blankId}
Choose the correct word: -
+
{words.map(({word, isDisabled}) => ( diff --git a/src/components/Solutions/MultipleChoice.tsx b/src/components/Solutions/MultipleChoice.tsx index d642af60..308a4654 100644 --- a/src/components/Solutions/MultipleChoice.tsx +++ b/src/components/Solutions/MultipleChoice.tsx @@ -59,8 +59,10 @@ export default function MultipleChoice({id, type, prompt, questions, userSolutio const calculateScore = () => { const total = questions.length; - const correct = userSolutions.filter((x) => questions.find((y) => y.id.toString() === x.question)?.solution === x.option || false).length; - const missing = total - userSolutions.filter((x) => questions.find((y) => y.id.toString() === x.question)).length; + const correct = userSolutions.filter( + (x) => questions.find((y) => y.id.toString() === x.question.toString())?.solution === x.option || false, + ).length; + const missing = total - userSolutions.filter((x) => questions.find((y) => y.id.toString() === x.question.toString())).length; return {total, correct, missing}; }; diff --git a/src/components/Solutions/WriteBlanks.tsx b/src/components/Solutions/WriteBlanks.tsx index 401df91c..db6e7bd8 100644 --- a/src/components/Solutions/WriteBlanks.tsx +++ b/src/components/Solutions/WriteBlanks.tsx @@ -80,11 +80,11 @@ export default function WriteBlanksSolutions({ const correct = userSolutions.filter( (x) => solutions - .find((y) => x.id === y.id.toString()) + .find((y) => x.id.toString() === y.id.toString()) ?.solution.map((y) => y.toLowerCase()) .includes(x.solution.toLowerCase()) || false, ).length; - const missing = total - userSolutions.filter((x) => solutions.find((y) => x.id === y.id.toString())).length; + const missing = total - userSolutions.filter((x) => solutions.find((y) => x.id.toString() === y.id.toString())).length; return {total, correct, missing}; }; @@ -94,10 +94,12 @@ export default function WriteBlanksSolutions({ {reactStringReplace(line, /({{\d+}})/g, (match) => { const id = match.replaceAll(/[\{\}]/g, "").toString(); - const userSolution = userSolutions.find((x) => x.id === id); - const solution = solutions.find((x) => x.id.toString() === id)!; + const userSolution = userSolutions.find((x) => x.id.toString() === id.toString()); + const solution = solutions.find((x) => x.id.toString() === id.toString())!; - return ; + return ( + + ); })} );