Solved a few bugs on the WriteBlanks module

This commit is contained in:
Tiago Ribeiro
2023-09-03 15:06:56 +01:00
parent 5263cc260d
commit 10b2f09c7f
10 changed files with 56 additions and 53 deletions

View File

@@ -93,8 +93,8 @@ export default function FillBlanks({
const calculateScore = () => {
const total = text.match(/({{\d+}})/g)?.length || 0;
const correct = answers.filter((x) => solutions.find((y) => x.id === y.id)?.solution === x.solution.toLowerCase() || false).length;
const missing = total - answers.filter((x) => solutions.find((y) => x.id === y.id)).length;
const correct = answers.filter((x) => solutions.find((y) => x.id === y.id.toString())?.solution === x.solution.toLowerCase() || false).length;
const missing = total - answers.filter((x) => solutions.find((y) => x.id === y.id.toString())).length;
return {total, correct, missing};
};