Previous Level exams were being broken by the part divider changes, fixed it.
This commit is contained in:
@@ -8,6 +8,7 @@ import reactStringReplace from "react-string-replace";
|
||||
import {CommonProps} from ".";
|
||||
import {toast} from "react-toastify";
|
||||
import Button from "../Low/Button";
|
||||
import useExamStore from "@/stores/examStore";
|
||||
|
||||
function Blank({
|
||||
id,
|
||||
@@ -71,6 +72,8 @@ export default function WriteBlanksSolutions({
|
||||
onNext,
|
||||
onBack,
|
||||
}: WriteBlanksExercise & CommonProps) {
|
||||
const {questionIndex, setQuestionIndex, partIndex, exam} = useExamStore((state) => state);
|
||||
|
||||
const calculateScore = () => {
|
||||
const total = text.match(/({{\d+}})/g)?.length || 0;
|
||||
const correct = userSolutions.filter(
|
||||
@@ -142,7 +145,14 @@ export default function WriteBlanksSolutions({
|
||||
color="purple"
|
||||
variant="outline"
|
||||
onClick={() => onBack({exercise: id, solutions: userSolutions, score: calculateScore(), type})}
|
||||
className="max-w-[200px] w-full">
|
||||
className="max-w-[200px] w-full"
|
||||
disabled={
|
||||
exam &&
|
||||
typeof partIndex !== "undefined" &&
|
||||
exam.module === "level" &&
|
||||
questionIndex === 0 &&
|
||||
partIndex === 0
|
||||
}>
|
||||
Back
|
||||
</Button>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user