diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5262ab34..158fd986 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -170,4 +170,4 @@ jobs: wget https://raw.githubusercontent.com/arquisoft/wiq_es1a/master/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_es1a/master/.env -O .env docker compose --profile prod down - docker compose --profile prod up -d + docker compose --profile prod up -d --pull always diff --git a/webapp/src/components/CustomModal/CustomModal.js b/webapp/src/components/CustomModal/CustomModal.js index 8e2c96e0..987c473e 100644 --- a/webapp/src/components/CustomModal/CustomModal.js +++ b/webapp/src/components/CustomModal/CustomModal.js @@ -16,7 +16,7 @@ const CustomModal = ({ title, text, route }) => { {title} - + {text} diff --git a/webapp/src/components/Nav/Nav.js b/webapp/src/components/Nav/Nav.js index 80846f52..b79c9bf9 100644 --- a/webapp/src/components/Nav/Nav.js +++ b/webapp/src/components/Nav/Nav.js @@ -8,6 +8,7 @@ const Nav = () => { const isDarkTheme = colorMode === "dark"; const textColor = isDarkTheme ? "white" : "teal.500"; const bgColor = isDarkTheme ? 'gray.700' : 'gray.200'; + const handleConfig = () => { navigate("/config"); }; diff --git a/webapp/src/pages/Bateria/Bateria.js b/webapp/src/pages/Bateria/Bateria.js index 26711079..9e06326f 100644 --- a/webapp/src/pages/Bateria/Bateria.js +++ b/webapp/src/pages/Bateria/Bateria.js @@ -59,16 +59,23 @@ const JuegoPreguntas = () => { const tMedio=TIME/preguntasTotales; setTiempoMedio(tMedio); } - if (juegoTerminado && tiempoMedio!=0) { - guardarPartida(); - } } const timer = setInterval(() => { setTiempoRestante((prevTiempo) => (prevTiempo <= 0 ? 0 : prevTiempo - 1)); }, 1000); return () => clearInterval(timer); + // eslint-disable-next-line }, [tiempoRestante]); + useEffect(() => { + if (juegoTerminado && tiempoMedio!=0) { + guardarPartida(); + } + // eslint-disable-next-line + }, [juegoTerminado, tiempoMedio]); + + + const guardarPartida = async () => { const username = localStorage.getItem("username"); @@ -105,6 +112,7 @@ const JuegoPreguntas = () => { }, 10); return () => clearInterval(timer); + // eslint-disable-next-line }, [tiempoRestante]); const handleSiguientePregunta = async (respuesta) => { diff --git a/webapp/src/pages/Clasico/Clasico.js b/webapp/src/pages/Clasico/Clasico.js index 4629ccfb..8f371aca 100644 --- a/webapp/src/pages/Clasico/Clasico.js +++ b/webapp/src/pages/Clasico/Clasico.js @@ -1,13 +1,13 @@ -import React, { useState, useEffect, useMemo } from "react"; +import React, { useState, useEffect } from "react"; import Nav from "../../components/Nav/Nav.js"; import { Link, useNavigate } from "react-router-dom"; import Footer from "../../components/Footer/Footer.js"; -import { Box, Flex, Heading, Button, Grid, useColorMode, Text, Image } from "@chakra-ui/react"; +import { Box, Flex, Heading, Button, Grid, useColorMode, Text, Image, Spinner } from "@chakra-ui/react"; import axios from "axios"; const JuegoPreguntas = () => { const URL = process.env.REACT_APP_API_ENDPOINT || "http://localhost:8000"; - const SECS_PER_QUESTION = useMemo(() => localStorage.getItem("clasicoTime")); + const SECS_PER_QUESTION = localStorage.getItem("clasicoTime"); const { colorMode } = useColorMode(); const isDarkTheme = colorMode === "dark"; @@ -54,7 +54,6 @@ const JuegoPreguntas = () => { setIsLoading(false); }) .catch((error) => { - console.error("Error al obtener las preguntas:", error); navigate("/home?error=1"); }); // eslint-disable-next-line @@ -140,20 +139,18 @@ const JuegoPreguntas = () => { setJuegoTerminado(true); if (preguntasCorrectas + preguntasFalladas > 0) { const preguntasTotales=preguntasCorrectas+preguntasFalladas; - console.log(preguntasCorrectas); - console.log(preguntasFalladas); const tMedio=tiempoTotal/preguntasTotales; setTiempoMedio(tMedio); - console.log(tMedio); } } }; useEffect(() => { - if (juegoTerminado && tiempoMedio!=0) { + if (juegoTerminado && tiempoMedio !== 0) { guardarPartida(); } + // eslint-disable-next-line }, [juegoTerminado]); const guardarPartida = async () => { @@ -202,7 +199,15 @@ const JuegoPreguntas = () => { return ( <>