From aabc86adf2f60167b309814d2d93258f3ebee53d Mon Sep 17 00:00:00 2001 From: Pelayori <31128562+Pelayori@users.noreply.github.com> Date: Sun, 10 Mar 2024 14:20:53 +0100 Subject: [PATCH] Hotfix: fix compile errors --- src/main/java/com/uniovi/services/GameSessionService.java | 2 +- .../com/uniovi/services/impl/QuestionServiceImpl.java | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/java/com/uniovi/services/GameSessionService.java b/src/main/java/com/uniovi/services/GameSessionService.java index e94cb4c3..e3eb4c55 100644 --- a/src/main/java/com/uniovi/services/GameSessionService.java +++ b/src/main/java/com/uniovi/services/GameSessionService.java @@ -26,7 +26,7 @@ public interface GameSessionService { */ List getGameSessionsByPlayer(Player player); - * Return the global ranking + /* Return the global ranking * * @param pageable the pageable * @return the global ranking diff --git a/src/main/java/com/uniovi/services/impl/QuestionServiceImpl.java b/src/main/java/com/uniovi/services/impl/QuestionServiceImpl.java index 1e48c356..61765939 100644 --- a/src/main/java/com/uniovi/services/impl/QuestionServiceImpl.java +++ b/src/main/java/com/uniovi/services/impl/QuestionServiceImpl.java @@ -43,14 +43,6 @@ public Optional getQuestion(Long id) { @Override public Optional getRandomQuestion() { - Long qty = questionRepository.count(); - int idx = (int)(Math.random() * qty); - Page questionPage = questionRepository.findAll(PageRequest.of(idx, 1)); - Question q = null; - if (questionPage.hasContent()) { - q = questionPage.getContent().get(0); - } - List allQuestions = questionRepository.findAll().stream() .filter(question -> question.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())).toList(); int idx = (int) (Math.random() * allQuestions.size());