Skip to content

Commit 99eee69

Browse files
committed
fix1
1 parent 6cda771 commit 99eee69

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

statistics/server/src/main/java/ru/practicum/statistics/repository/HitRepository.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ public interface HitRepository extends JpaRepository<HitEntity, Long> {
1313
@Query("SELECT h.app, h.uri, COUNT(DISTINCT h.ip) as hits FROM HitEntity h " +
1414
"WHERE h.timestamp BETWEEN :start AND :end " +
1515
"AND (:uris IS NULL OR h.uri IN :uris) " +
16-
"GROUP BY h.app, h.uri")
16+
"GROUP BY h.app, h.uri " +
17+
"ORDER BY hits DESC")
1718
List<Object[]> countUniqueHits(@Param("start") LocalDateTime start,
1819
@Param("end") LocalDateTime end,
1920
@Param("uris") List<String> uris);
2021

2122
@Query("SELECT h.app, h.uri, COUNT(h) as hits FROM HitEntity h " +
2223
"WHERE h.timestamp BETWEEN :start AND :end " +
2324
"AND (:uris IS NULL OR h.uri IN :uris) " +
24-
"GROUP BY h.app, h.uri")
25+
"GROUP BY h.app, h.uri " +
26+
"ORDER BY hits DESC")
2527
List<Object[]> countAllHits(@Param("start") LocalDateTime start,
2628
@Param("end") LocalDateTime end,
2729
@Param("uris") List<String> uris);

0 commit comments

Comments
 (0)