Update query to use startTime instead of createdAt (#2272)
This commit is contained in:
+3
-3
@@ -16,11 +16,11 @@ import java.util.List;
|
||||
public interface ReadingSessionRepository extends JpaRepository<ReadingSessionEntity, Long> {
|
||||
|
||||
@Query("""
|
||||
SELECT CAST(rs.createdAt AS LocalDate) as date, COUNT(rs) as count
|
||||
SELECT CAST(rs.startTime AS LocalDate) as date, COUNT(rs) as count
|
||||
FROM ReadingSessionEntity rs
|
||||
WHERE rs.user.id = :userId
|
||||
AND YEAR(rs.createdAt) = :year
|
||||
GROUP BY CAST(rs.createdAt AS LocalDate)
|
||||
AND YEAR(rs.startTime) = :year
|
||||
GROUP BY CAST(rs.startTime AS LocalDate)
|
||||
ORDER BY date
|
||||
""")
|
||||
List<ReadingSessionCountDto> findSessionCountsByUserAndYear(@Param("userId") Long userId, @Param("year") int year);
|
||||
|
||||
Reference in New Issue
Block a user