Skip to content

Commit

Permalink
Resolucion problemas fin de partida
Browse files Browse the repository at this point in the history
  • Loading branch information
uo264915 committed Apr 7, 2024
1 parent 3cc157c commit 92cce23
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 60 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,4 @@ jobs:
docker compose --profile prod down
docker compose --profile prod up -d --pull always
wget https://raw.githubusercontent.com/arquisoft/wiq_0/master/docker-compose.yml -O docker-compose.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_0/master/.env -O .env
docker compose --profile prod down
docker compose --profile prod up -d --pull always
22 changes: 12 additions & 10 deletions webapp/src/components/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const Game = () => {
const [questionCounter, setQuestionCounter] = useState(0);
const [incorrectCounter, setIncorrectCounter] = useState(0);

const [numberOfQuestions, setNumberOfQuestions] = useState(10);
const [questionsToAnswer, setQuestionsToAnswer] = useState(10);
const [numberOfQuestions] = useState(3);
const [questionsToAnswer, setQuestionsToAnswer] = useState(3);
const [isFinished, setFinished] = useState(false);
const [percentage, setPercentage] = useState(0);

Expand Down Expand Up @@ -55,9 +55,16 @@ const Game = () => {
useEffect(() => {
if (isGameFinished() && !isFinished){
finishGame();
setFinished(true)
setFinished(true);
; }
}, [correctCounter]);

useEffect(() => {
if (isGameFinished() && !isFinished){
finishGame();
setFinished(true);
; }
}, [incorrectCounter]);

// This method will call the create question service
const handleShowQuestion = async () => {
Expand All @@ -84,11 +91,8 @@ const Game = () => {
button.onmouse = colorOnMousePreguntas;
});



incrementQuestion();


}catch (error){
console.error('Error:', error);
}
Expand Down Expand Up @@ -134,13 +138,11 @@ const Game = () => {

decrementQuestionsToAnswer();


if (!isFinished){
if (!isGameFinished()) {
setTimeout(() => {
handleShowQuestion();
}, 850);
}, 1000);
}

}

const isGameFinished = () => {
Expand Down
39 changes: 0 additions & 39 deletions webapp/src/components/HistoricalQuestions.js

This file was deleted.

7 changes: 0 additions & 7 deletions webapp/src/components/MainPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ const MainPage = () => {
navigate(path);
};

const handleShowHistoricalQuestions = () => {
let path= '/HistoricalQuestions';
navigate(path);
};

return (
<Container component="main" maxWidth="xs" sx={{ marginTop: 4 }}>
Expand All @@ -46,9 +42,6 @@ const MainPage = () => {
<Button variant="contained" color="primary" onClick={handleShowHistoricalUserData}>
Histórico del usuario
</Button>
<Button variant="contained" color="primary" onClick={handleShowHistoricalQuestions}>
Histórico de preguntas
</Button>
</div>
</Container>
)
Expand Down

0 comments on commit 92cce23

Please sign in to comment.