diff --git a/src/components/Solutions/Speaking.tsx b/src/components/Solutions/Speaking.tsx index b62c0d83..663bf13e 100644 --- a/src/components/Solutions/Speaking.tsx +++ b/src/components/Solutions/Speaking.tsx @@ -5,6 +5,7 @@ import {Fragment, useEffect, useState} from "react"; import Button from "../Low/Button"; import dynamic from "next/dynamic"; import axios from "axios"; +import {speakingReverseMarking} from "@/utils/score"; const Waveform = dynamic(() => import("../Waveform"), {ssr: false}); @@ -78,7 +79,7 @@ export default function Speaking({id, type, title, text, prompts, userSolutions, onBack({ exercise: id, solutions: userSolutions, - score: {correct: 1, total: 1, missing: 0}, + score: {total: 100, missing: 0, correct: speakingReverseMarking[userSolutions[0]!.evaluation!.overall] || 0}, type, }) } @@ -91,7 +92,7 @@ export default function Speaking({id, type, title, text, prompts, userSolutions, onNext({ exercise: id, solutions: userSolutions, - score: {correct: 1, total: 1, missing: 0}, + score: {total: 100, missing: 0, correct: speakingReverseMarking[userSolutions[0]!.evaluation!.overall] || 0}, type, }) } diff --git a/src/components/Solutions/Writing.tsx b/src/components/Solutions/Writing.tsx index ef12a7d9..b64316da 100644 --- a/src/components/Solutions/Writing.tsx +++ b/src/components/Solutions/Writing.tsx @@ -9,6 +9,7 @@ import {Fragment, useEffect, useState} from "react"; import {toast} from "react-toastify"; import Button from "../Low/Button"; import {Dialog, Transition} from "@headlessui/react"; +import {writingReverseMarking} from "@/utils/score"; export default function Writing({id, type, prompt, attachment, userSolutions, onNext, onBack}: WritingExercise & CommonProps) { const [isModalOpen, setIsModalOpen] = useState(false); @@ -99,13 +100,27 @@ export default function Writing({id, type, prompt, attachment, userSolutions, on diff --git a/src/pages/exam.tsx b/src/pages/exam.tsx index 734e2ecd..848dd05a 100644 --- a/src/pages/exam.tsx +++ b/src/pages/exam.tsx @@ -93,7 +93,7 @@ export default function Page() { }, [selectedModules, setExams, exams]); useEffect(() => { - if (selectedModules.length > 0 && exams.length !== 0 && moduleIndex >= selectedModules.length && !hasBeenUploaded) { + if (selectedModules.length > 0 && exams.length !== 0 && moduleIndex >= selectedModules.length && !hasBeenUploaded && !showSolutions) { const newStats: Stat[] = userSolutions.map((solution) => ({ ...solution, session: sessionId, diff --git a/src/pages/exercises.tsx b/src/pages/exercises.tsx index a0b14a86..ace38235 100644 --- a/src/pages/exercises.tsx +++ b/src/pages/exercises.tsx @@ -96,7 +96,9 @@ export default function Page() { }, [selectedModules, setExams, exams]); useEffect(() => { - if (selectedModules.length > 0 && exams.length !== 0 && moduleIndex >= selectedModules.length && !hasBeenUploaded) { + if (selectedModules.length > 0 && exams.length !== 0 && moduleIndex >= selectedModules.length && !hasBeenUploaded && !showSolutions) { + alert("HEHE"); + const newStats: Stat[] = userSolutions.map((solution) => ({ ...solution, session: sessionId,