Skip to content

Commit

Permalink
Hotfix: fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pelayori committed Mar 10, 2024
1 parent b08226e commit aabc86a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/uniovi/services/GameSessionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface GameSessionService {
*/
List<GameSession> getGameSessionsByPlayer(Player player);

* Return the global ranking
/* Return the global ranking
*
* @param pageable the pageable
* @return the global ranking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ public Optional<Question> getQuestion(Long id) {

@Override
public Optional<Question> getRandomQuestion() {
Long qty = questionRepository.count();
int idx = (int)(Math.random() * qty);
Page<Question> questionPage = questionRepository.findAll(PageRequest.of(idx, 1));
Question q = null;
if (questionPage.hasContent()) {
q = questionPage.getContent().get(0);
}

List<Question> allQuestions = questionRepository.findAll().stream()
.filter(question -> question.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())).toList();
int idx = (int) (Math.random() * allQuestions.size());
Expand Down

0 comments on commit aabc86a

Please sign in to comment.