From a1c33f2d8fe01ffbefa880fe045d0986de0ce34f Mon Sep 17 00:00:00 2001
From: UO287568
Date: Wed, 10 Apr 2024 20:24:26 +0200
Subject: [PATCH 1/2] =?UTF-8?q?Correci=C3=B3n=20contador=20de=20preguntas?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/resources/templates/game/basicGame.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/resources/templates/game/basicGame.html b/src/main/resources/templates/game/basicGame.html
index 43c37fad..52236c9c 100644
--- a/src/main/resources/templates/game/basicGame.html
+++ b/src/main/resources/templates/game/basicGame.html
@@ -14,7 +14,7 @@
/
-
+
From 5d3c4c4f3e8b596fb122a847bae3ac2fdb15797b Mon Sep 17 00:00:00 2001
From: UO287568
Date: Thu, 11 Apr 2024 20:14:59 +0200
Subject: [PATCH 2/2] =?UTF-8?q?Correci=C3=B3n=20primera=20respuesta=20la?=
=?UTF-8?q?=20correcta?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/generators/AbstractQuestionGenerator.java | 2 +-
src/main/java/com/uniovi/entities/Question.java | 7 ++++++-
src/main/resources/templates/game/fragments/gameFrame.html | 4 ++--
src/test/java/com/uniovi/Wiq_UnitTests.java | 4 ++--
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/uniovi/components/generators/AbstractQuestionGenerator.java b/src/main/java/com/uniovi/components/generators/AbstractQuestionGenerator.java
index 9754c2c5..fd192279 100644
--- a/src/main/java/com/uniovi/components/generators/AbstractQuestionGenerator.java
+++ b/src/main/java/com/uniovi/components/generators/AbstractQuestionGenerator.java
@@ -44,7 +44,7 @@ public void questionGenerator(String statement, List options, String cor
answers.add(correct);
Question question = new Question(statement, answers, correct, category, language);
- question.scrambleOptions();
+ //question.scrambleOptions();
questions.add(question);
}
diff --git a/src/main/java/com/uniovi/entities/Question.java b/src/main/java/com/uniovi/entities/Question.java
index 10ac54f3..aad73c71 100644
--- a/src/main/java/com/uniovi/entities/Question.java
+++ b/src/main/java/com/uniovi/entities/Question.java
@@ -78,8 +78,13 @@ public boolean isCorrectAnswer(Answer answer){
return answer.isCorrect();
}
- public void scrambleOptions(){
+ /*public void scrambleOptions(){
+ Collections.shuffle(options); USO EN LOS TESTS Y ABSTRACTQUESTIONGENERATOR
+ }*/
+
+ public List returnScrambledOptions(){
Collections.shuffle(options);
+ return options;
}
@Override
diff --git a/src/main/resources/templates/game/fragments/gameFrame.html b/src/main/resources/templates/game/fragments/gameFrame.html
index 7dc5fea5..8f81a3ec 100644
--- a/src/main/resources/templates/game/fragments/gameFrame.html
+++ b/src/main/resources/templates/game/fragments/gameFrame.html
@@ -4,7 +4,7 @@
-
@@ -48,7 +48,7 @@
let progressBar = $('#progressBar');
let currentTime = parseFloat(progressBar.attr('aria-valuenow'));
let decrement = 100 * updateInterval / timeoutPeriod;
- let newTime = Math.max(0, currentTime - decrement);;
+ let newTime = Math.max(0, currentTime - decrement);
// Calculate the color based on the percentage
let greenValue = Math.round((newTime * 255) / 100);
let redValue = 255 - greenValue;
diff --git a/src/test/java/com/uniovi/Wiq_UnitTests.java b/src/test/java/com/uniovi/Wiq_UnitTests.java
index c28558c4..52494d87 100644
--- a/src/test/java/com/uniovi/Wiq_UnitTests.java
+++ b/src/test/java/com/uniovi/Wiq_UnitTests.java
@@ -453,8 +453,8 @@ public void testScrambleOptions() {
question.addOption(option2);
question.addOption(option3);
- question.scrambleOptions();
- List
scrambledOptions = question.getOptions();
+ // question.scrambleOptions();
+ List scrambledOptions = question.returnScrambledOptions();
Assertions.assertTrue(scrambledOptions.contains(option1));
Assertions.assertTrue(scrambledOptions.contains(option2));