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

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

View File

@@ -24,7 +24,7 @@ import useGroups from "@/hooks/useGroups";
import {shouldRedirectHome} from "@/utils/navigation.disabled";
import useAssignments from "@/hooks/useAssignments";
import {uuidv4} from "@firebase/util";
import { usePDFDownload } from "@/hooks/usePDFDownload";
import {usePDFDownload} from "@/hooks/usePDFDownload";
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
const user = req.session.user;
@@ -175,7 +175,7 @@ export default function History({user}: {user: User}) {
level: calculateBandScore(x.correct, x.total, x.module, user.focus),
}));
const { timeSpent, session } = dateStats[0];
const {timeSpent, session} = dateStats[0];
const selectExam = () => {
const examPromises = uniqBy(dateStats, "exam").map((stat) => getExamById(stat.module, stat.exam));
@@ -201,7 +201,7 @@ export default function History({user}: {user: User}) {
correct / total >= 0.3 && correct / total < 0.7 && "text-mti-red",
correct / total < 0.3 && "text-mti-rose",
);
const content = (
<>
<div className="w-full flex justify-between -md:items-center 2xl:items-center">
@@ -215,8 +215,7 @@ export default function History({user}: {user: User}) {
)}
</div>
<div className="flex flex-row gap-2">
<span
className={textColor}>
<span className={textColor}>
Level{" "}
{(aggregatedLevels.reduce((accumulator, current) => accumulator + current.level, 0) / aggregatedLevels.length).toFixed(1)}
</span>