Skip to content

Commit

Permalink
fix: missing SELECT from query
Browse files Browse the repository at this point in the history
  • Loading branch information
jjgancfer committed Apr 17, 2024
1 parent 8f840df commit c81b41d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/src/main/java/lab/en2b/quizapi/game/GameRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface GameRepository extends JpaRepository<Game,Long> {
@Query(value = "SELECT * FROM Games g WHERE user_id = ?1 AND g.is_game_over = false LIMIT 1", nativeQuery = true)
Optional<Game> findActiveGameForUser(Long userId);

@Query(value = "COUNT(*) FROM Games g WHERE user_id = ?1 AND g.is_game_over = true", nativeQuery = true)
@Query(value = "SELECT COUNT(*) FROM Games g WHERE user_id = ?1 AND g" +
".is_game_over = true", nativeQuery = true)
Long countFinishedGamesForUser(Long userId);
}

0 comments on commit c81b41d

Please sign in to comment.