Solved a few bugs on the WriteBlanks module
This commit is contained in:
@@ -8,8 +8,10 @@ import Button from "../Low/Button";
|
||||
export default function FillBlanksSolutions({id, type, prompt, solutions, text, userSolutions, onNext, onBack}: FillBlanksExercise & CommonProps) {
|
||||
const calculateScore = () => {
|
||||
const total = text.match(/({{\d+}})/g)?.length || 0;
|
||||
const correct = userSolutions.filter((x) => solutions.find((y) => x.id === y.id)?.solution === x.solution.toLowerCase() || false).length;
|
||||
const missing = total - userSolutions.filter((x) => solutions.find((y) => x.id === y.id)).length;
|
||||
const correct = userSolutions.filter(
|
||||
(x) => solutions.find((y) => x.id === y.id.toString())?.solution === x.solution.toLowerCase() || false,
|
||||
).length;
|
||||
const missing = total - userSolutions.filter((x) => solutions.find((y) => x.id === y.id.toString())).length;
|
||||
|
||||
return {total, correct, missing};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user