Skip to content

Commit

Permalink
Merge branch 'coral-updates'
Browse files Browse the repository at this point in the history
  • Loading branch information
coral2742 committed May 7, 2024
2 parents fa4d12f + 02f2e0f commit 6fce1ad
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 102 deletions.
2 changes: 1 addition & 1 deletion docs/src/13_testability.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ifndef::imagesdir[:imagesdir: ../images]

[[section-technical-risks]]
[[section-testability]]
== Testability
Testability is a crucial aspect of software development. It refers to the ease with which a software system can be tested to ensure its correctness and reliability. By writing tests, developers can verify that their code behaves as expected and identify any potential issues or bugs. There are various types of tests that can be performed, such as unit tests, integration tests, and end-to-end tests. Unit tests focus on testing individual components or functions in isolation, while integration tests verify the interaction between different components. End-to-end tests simulate real-world scenarios to ensure the entire system functions correctly.

Expand Down
44 changes: 8 additions & 36 deletions webapp/src/components/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ const Game = () => {
button.onmouse = colorOnMousePreguntas;
});

incrementQuestion();



setQuestionCounter(qc => qc + 1);


}catch (error){
console.error('Error:', error);
Expand All @@ -227,7 +225,7 @@ const Game = () => {
const correctButton = document.getElementById(buttonId);
if (correctButton) {
correctButton.style.backgroundColor = "rgba(79, 141, 18, 0.726)";
incrementCorrect();
setCorrectCounter(correct => correct + 1);
}
}else{
const buttonId = `button_${index}`;
Expand All @@ -244,7 +242,7 @@ const Game = () => {
}
}

incrementIncorrect();
setIncorrectCounter(incorrect => incorrect + 1);
}

const buttons = document.querySelectorAll('button[title="btnsPreg"]');
Expand All @@ -253,7 +251,7 @@ const Game = () => {
button.onmouse = null;
});

decrementQuestionsToAnswer();
setQuestionsToAnswer(toAnswer => toAnswer - 1);

if (!isGameFinished()) {
setTimeout(() => {
Expand Down Expand Up @@ -314,14 +312,6 @@ const getQuestions = () => {
correctAnswers: correctCounter,
incorrectAnswers: numberOfQuestions-correctCounter
};
//console.log("Se va a guardar la siguiente partida:");
//console.log("Username:", newGame.username);
//console.log("Duración:", newGame.duration);
//console.log("Preguntas:", newGame.questions);
//console.log("Porcentaje de Aciertos:", newGame.percentage);
//console.log("Número Total de Preguntas:", newGame.totalQuestions);
//console.log("Número de Respuestas Correctas:", newGame.correctAnswers);
//console.log("Número de Respuestas Incorrectas:", newGame.incorrectAnswers);
setGameData(newGame);


Expand All @@ -334,24 +324,6 @@ const getQuestions = () => {
});
}

const incrementCorrect = () => {
setCorrectCounter(correct => correct + 1);
};

const incrementIncorrect = () => {
setIncorrectCounter(incorrect => incorrect + 1);
}

const decrementQuestionsToAnswer = () => {
setQuestionsToAnswer(toAnswer => toAnswer - 1);
}

const incrementQuestion = () => {
setQuestionCounter(qc => qc + 1);
}



useEffect(() => {
if (isTimedOut && !isFinished) {
// mostrar la respuesta correcta
Expand All @@ -364,8 +336,8 @@ const getQuestions = () => {
}
}

incrementIncorrect();
decrementQuestionsToAnswer();
setIncorrectCounter(incorrect => incorrect + 1);
setQuestionsToAnswer(toAnswer => toAnswer - 1);

setTimeout(() => {
if (!isGameFinished()) {
Expand Down Expand Up @@ -417,7 +389,7 @@ const getQuestions = () => {
</div>


<div className="Timer">
<div className="Timer" data-testid="Timer">
<div className="container">
<div className="text">{time}</div>

Expand Down
Loading

0 comments on commit 6fce1ad

Please sign in to comment.