Also updated the MultipleChoice exercise to the new design

This commit is contained in:
Tiago Ribeiro
2023-06-18 22:57:53 +01:00
parent 52218ff8b8
commit 87e0610c79
4 changed files with 39 additions and 130 deletions

View File

@@ -1,8 +1,4 @@
import {errorButtonStyle, infoButtonStyle} from "@/constants/buttonStyles";
import {FillBlanksExercise} from "@/interfaces/exam";
import {Dialog, Transition} from "@headlessui/react";
import {mdiArrowLeft, mdiArrowRight} from "@mdi/js";
import Icon from "@mdi/react";
import clsx from "clsx";
import {Fragment, useEffect, useState} from "react";
import reactStringReplace from "react-string-replace";
@@ -78,8 +74,6 @@ export default function FillBlanks({id, allowRepetition, type, prompt, solutions
setBlankSelectedWord(currentBlankId ? userSolutions.find((x) => x.id === currentBlankId)?.solution : undefined);
}, [userSolutions, currentBlankId]);
useEffect(() => console.log({blankSelectedWord}), [blankSelectedWord]);
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;
@@ -87,10 +81,6 @@ export default function FillBlanks({id, allowRepetition, type, prompt, solutions
return {total, correct};
};
useEffect(() => {
console.log(currentBlankId, userSolutions.find((x) => x.id === currentBlankId)?.solution);
}, [userSolutions, currentBlankId]);
const renderLines = (line: string) => {
return (
<span className="text-base leading-5">