Updated the problems with the marking - related to the DB not having the correct type
This commit is contained in:
@@ -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({
|
||||
<span className="text-base leading-5">
|
||||
{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 <Blank userSolution={userSolution?.solution} maxWords={maxWords} id={id} solutions={solution.solution} disabled />;
|
||||
return (
|
||||
<Blank userSolution={userSolution?.solution} maxWords={maxWords} id={id.toString()} solutions={solution.solution} disabled />
|
||||
);
|
||||
})}
|
||||
</span>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user