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> {
|
public interface ReadingSessionRepository extends JpaRepository<ReadingSessionEntity, Long> {
|
||||||
|
|
||||||
@Query("""
|
@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
|
FROM ReadingSessionEntity rs
|
||||||
WHERE rs.user.id = :userId
|
WHERE rs.user.id = :userId
|
||||||
AND YEAR(rs.createdAt) = :year
|
AND YEAR(rs.startTime) = :year
|
||||||
GROUP BY CAST(rs.createdAt AS LocalDate)
|
GROUP BY CAST(rs.startTime AS LocalDate)
|
||||||
ORDER BY date
|
ORDER BY date
|
||||||
""")
|
""")
|
||||||
List<ReadingSessionCountDto> findSessionCountsByUserAndYear(@Param("userId") Long userId, @Param("year") int year);
|
List<ReadingSessionCountDto> findSessionCountsByUserAndYear(@Param("userId") Long userId, @Param("year") int year);
|
||||||
|
|||||||
Reference in New Issue
Block a user