Skip to content

Commit

Permalink
fix: fixed points
Browse files Browse the repository at this point in the history
  • Loading branch information
Toto-hitori committed Apr 28, 2024
1 parent 3abda31 commit 16cd950
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface StatisticsRepository extends JpaRepository<Statistics, Long> {
@Query(value = "SELECT *, \n" +
" CASE \n" +
" WHEN total = 0 THEN 0 \n" +
" ELSE (correct * 100.0 / NULLIF(total, 0)) * total \n" +
" ELSE (correct * 100.0 / NULLIF(total, 0)) * correct \n" +
" END AS points \n" +
"FROM Statistics \n" +
"ORDER BY points DESC LIMIT 10 ", nativeQuery = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public StatisticsResponseDto apply(Statistics statistics) {
.total(statistics.getTotal())
.percentage(statistics.getCorrectRate())
.user(userResponseDtoMapper.apply(statistics.getUser()))
.points(statistics.getCorrectRate() * statistics.getTotal() )
.points(statistics.getCorrectRate() * statistics.getCorrect() )
.finishedGames(statistics.getFinishedGames())
.build();
}
Expand Down

0 comments on commit 16cd950

Please sign in to comment.