Solved another bug with the TrueFalse

This commit is contained in:
Tiago Ribeiro
2024-01-14 23:18:51 +00:00
parent 24ec336dca
commit b7a3778f01
2 changed files with 10 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ interface Props {
export default function ExamPage({page}: Props) {
const [hasBeenUploaded, setHasBeenUploaded] = useState(false);
const [moduleIndex, setModuleIndex] = useState(-1);
const [moduleIndex, setModuleIndex] = useState(0);
const [sessionId, setSessionId] = useState("");
const [exam, setExam] = useState<Exam>();
const [isEvaluationLoading, setIsEvaluationLoading] = useState(false);
@@ -64,6 +64,10 @@ export default function ExamPage({page}: Props) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedModules.length]);
useEffect(() => {
if (showSolutions) setModuleIndex(-1);
}, [showSolutions]);
useEffect(() => {
(async () => {
if (selectedModules.length > 0 && exams.length > 0 && moduleIndex < selectedModules.length) {