Updated the Record to start with the overall screen

This commit is contained in:
Tiago Ribeiro
2024-01-14 23:13:12 +00:00
parent e324b37942
commit 24ec336dca
3 changed files with 10 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable @next/next/no-img-element */ /* eslint-disable @next/next/no-img-element */
import {WritingExercise} from "@/interfaces/exam"; import {WritingExercise} from "@/interfaces/exam";
import {CommonProps} from "."; import {CommonProps} from ".";
import {Fragment, useState} from "react"; import {Fragment, useEffect, useState} from "react";
import Button from "../Low/Button"; import Button from "../Low/Button";
import {Dialog, Tab, Transition} from "@headlessui/react"; import {Dialog, Tab, Transition} from "@headlessui/react";
import {writingReverseMarking} from "@/utils/score"; import {writingReverseMarking} from "@/utils/score";
@@ -85,7 +85,7 @@ export default function Writing({id, type, prompt, attachment, userSolutions, on
</div> </div>
<div className="w-full h-full flex flex-col gap-8"> <div className="w-full h-full flex flex-col gap-8">
{userSolutions && ( {userSolutions && userSolutions.length > 0 && (
<div className="flex flex-col gap-4 w-full"> <div className="flex flex-col gap-4 w-full">
<span>Your answer:</span> <span>Your answer:</span>
<div className="w-full h-full min-h-[320px] cursor-text px-7 py-8 input border-2 border-mti-gray-platinum bg-white rounded-3xl whitespace-pre-wrap"> <div className="w-full h-full min-h-[320px] cursor-text px-7 py-8 input border-2 border-mti-gray-platinum bg-white rounded-3xl whitespace-pre-wrap">

View File

@@ -30,7 +30,7 @@ interface Props {
export default function ExamPage({page}: Props) { export default function ExamPage({page}: Props) {
const [hasBeenUploaded, setHasBeenUploaded] = useState(false); const [hasBeenUploaded, setHasBeenUploaded] = useState(false);
const [moduleIndex, setModuleIndex] = useState(0); const [moduleIndex, setModuleIndex] = useState(-1);
const [sessionId, setSessionId] = useState(""); const [sessionId, setSessionId] = useState("");
const [exam, setExam] = useState<Exam>(); const [exam, setExam] = useState<Exam>();
const [isEvaluationLoading, setIsEvaluationLoading] = useState(false); const [isEvaluationLoading, setIsEvaluationLoading] = useState(false);
@@ -247,14 +247,15 @@ export default function ExamPage({page}: Props) {
user={user!} user={user!}
disableSelection={page === "exams"} disableSelection={page === "exams"}
onStart={(modules, avoid) => { onStart={(modules, avoid) => {
setSelectedModules(modules); setModuleIndex(0);
setAvoidRepeated(avoid); setAvoidRepeated(avoid);
setSelectedModules(modules);
}} }}
/> />
); );
} }
if (moduleIndex >= selectedModules.length) { if (moduleIndex >= selectedModules.length || moduleIndex === -1) {
return ( return (
<Finish <Finish
isLoading={isEvaluationLoading} isLoading={isEvaluationLoading}

View File

@@ -215,8 +215,7 @@ export default function History({user}: {user: User}) {
)} )}
</div> </div>
<div className="flex flex-row gap-2"> <div className="flex flex-row gap-2">
<span <span className={textColor}>
className={textColor}>
Level{" "} Level{" "}
{(aggregatedLevels.reduce((accumulator, current) => accumulator + current.level, 0) / aggregatedLevels.length).toFixed(1)} {(aggregatedLevels.reduce((accumulator, current) => accumulator + current.level, 0) / aggregatedLevels.length).toFixed(1)}
</span> </span>