diff --git a/src/main/java/sws/songpin/domain/pin/repository/PinRepository.java b/src/main/java/sws/songpin/domain/pin/repository/PinRepository.java index ce9d84c..f5acdeb 100644 --- a/src/main/java/sws/songpin/domain/pin/repository/PinRepository.java +++ b/src/main/java/sws/songpin/domain/pin/repository/PinRepository.java @@ -36,8 +36,8 @@ public interface PinRepository extends JpaRepository { @Query("SELECT p FROM Pin p WHERE p.creator = :creator AND YEAR(p.listenedDate) = :year AND MONTH(p.listenedDate) = :month") List findAllByCreatorAndDate(@Param("creator") Member creator, @Param("year") int year, @Param("month") int month); - @Query("SELECT COUNT(p) FROM Pin p WHERE YEAR(p.listenedDate) = :currentYear") - long countByListenedDateYear(@Param("currentYear") int currentYear); + @Query("SELECT COUNT(p) FROM Pin p WHERE YEAR(p.createdTime) = :currentYear") + long countByCreatedTimeYear(@Param("currentYear") int currentYear); @Query("SELECT p.genre.genreName, COUNT(p) FROM Pin p GROUP BY p.genre ORDER BY COUNT(p) DESC") List findMostPopularGenreName(); diff --git a/src/main/java/sws/songpin/domain/statistics/service/StatisticsService.java b/src/main/java/sws/songpin/domain/statistics/service/StatisticsService.java index 7b6614d..3af4e3c 100644 --- a/src/main/java/sws/songpin/domain/statistics/service/StatisticsService.java +++ b/src/main/java/sws/songpin/domain/statistics/service/StatisticsService.java @@ -38,7 +38,7 @@ public StatsOverallResponseDto getOverallStats() { } public long getTotalPinCount() { - return pinRepository.countByListenedDateYear(LocalDate.now().getYear()); + return pinRepository.countByCreatedTimeYear(LocalDate.now().getYear()); } @Transactional(readOnly = true)