Skip to content

Commit

Permalink
Merge pull request #183 from 8attery/feat/40-project
Browse files Browse the repository at this point in the history
Fix(#171-project): 배터리 수준 조회 atStartOfDay() 추가
  • Loading branch information
hojeong2747 authored May 25, 2023
2 parents 1ad65f2 + 4ded34c commit 37f7384
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 37f7384

Please sign in to comment.