Skip to content

Commit

Permalink
issues
Browse files Browse the repository at this point in the history
  • Loading branch information
uo288574 committed Apr 24, 2024
1 parent 0db60ea commit 3850339
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 13 additions & 10 deletions webapp/src/components/game/GameConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const GameConfiguration = () => {
console.log(tematicas)


const navigation = useNavigate();
// Almacen de temáticas
const [tematicasSeleccionadas, setTematicasSeleccionadas] = useState([]);
// Almacen para el número de preguntas
Expand Down Expand Up @@ -80,15 +79,19 @@ const GameConfiguration = () => {
try {
const response = await axios.get(`${apiEndpoint}/gameQuestions`, {gameId, tematicasSeleccionadas});
console.log(response.data.length)
for (var i = 0; i < response.data.length; i++) {
var possibleAnswers = [response.data[i].respuesta_correcta, response.data[i].respuestas_incorrectas[0], response.data[i].respuestas_incorrectas[1], response.data[i].respuestas_incorrectas[2]]
possibleAnswers = shuffleArray(possibleAnswers)
questions.push({
question: response.data[i].pregunta,
options: possibleAnswers,
correctAnswer: response.data[i].respuesta_correcta
})
}

for(const data of response.data){
let possibleAnswers = [data.respuesta_correcta,
data.respuestas_incorrectas[0],
data.respuestas_incorrectas[1],
data.respuestas_incorrectas[2]];
possibleAnswers = shuffleArray(possibleAnswers)
questions.push({
question: data.pregunta,
options: possibleAnswers,
correctAnswer: data.respuesta_correcta
})
}
} catch (error) {
console.error(error);
}
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/nav/Nav.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, fireEvent } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { ContextFun } from '../Context';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
Expand Down

0 comments on commit 3850339

Please sign in to comment.