Skip to content

Commit

Permalink
Fix(#171-project): 배터리 수준 조회 atStartOfDay() 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hojeong2747 committed May 25, 2023
1 parent 958c44c commit 4ded34c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public interface BatteryRepository extends JpaRepository<Battery, Long> {
"where b2.user.id=:userId " +
"and b1.createdAt between :startDate and :endDate " +
"order by b1.createdAt desc")
List<BatteryPercentResponseDto> findUserBatteryHistory(@Param("userId") Long userId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
List<BatteryPercentResponseDto> findUserBatteryHistory(@Param("userId") Long userId, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);


// 배터리 증감 조회 (30일 증감 내역)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public List<BatteryPercentResponseDto> getUserBatteryHistory(Long userId) throws
// LocalDateTime endDate = LocalDateTime.now(); // Current date and time
// LocalDateTime startDate = endDate.minusDays(7); // 7 days ago

LocalDate endDate = LocalDate.now(); // Current date and time
LocalDate startDate = endDate.minusDays(7); // 7 days ago
LocalDateTime endDate = LocalDate.now().atStartOfDay(); // Current date and time
LocalDateTime startDate = endDate.minusDays(7); // 7 days ago

return batteryRepository.findUserBatteryHistory(userId, startDate, endDate);

Expand Down

0 comments on commit 4ded34c

Please sign in to comment.