From 149ff6a654d1b8f31feab281424f732bd270c371 Mon Sep 17 00:00:00 2001 From: alegarman2002 <116609314+alegarman2002@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:36:49 +0200 Subject: [PATCH] Fixed some problems with the question management --- webapp/src/components/FirstGame.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/FirstGame.js b/webapp/src/components/FirstGame.js index b6179bbb..a97c7646 100644 --- a/webapp/src/components/FirstGame.js +++ b/webapp/src/components/FirstGame.js @@ -30,12 +30,13 @@ const Quiz = () => { // const [currentQuestionIndex, setCurrentQuestionIndex] = useState(storedInt); // const [isCorrect, setIsCorrect] = useState(false); const [remTime, setRemTime] = useState(0); + const [totalTime, setTotalTime] = useState(0); useEffect(() => { const time = setInterval(() => { setRemTime((progress) => { if(progress === 100){ - // checkAnswer(-1); + checkAnswer(-1); return 0; } const diff = 4; @@ -102,10 +103,15 @@ const Quiz = () => { currentQuestionIndex = (currentQuestionIndex + 1); botonCorrecta.style.backgroundColor = previousBackgroundColor changeButtons("false") - await gameStore() + haveFailedQuestion = false; load = true - navigator('/menu') + haveEnter = false + + if (currentQuestionIndex === allQuestions.length ) { + await gameStore() + navigator('/menu') + } return }