diff --git a/src/main/java/com/diareat/diareat/food/service/FoodService.java b/src/main/java/com/diareat/diareat/food/service/FoodService.java index 65e64df..14519c6 100644 --- a/src/main/java/com/diareat/diareat/food/service/FoodService.java +++ b/src/main/java/com/diareat/diareat/food/service/FoodService.java @@ -249,7 +249,7 @@ public ResponseAnalysisDto getAnalysisOfUser(Long userId, int year, int month, i User user = userRepository.getReferenceById(userId); //현재 날짜 - LocalDate currentDate = LocalDate.of(year,month,day); + LocalDate currentDate = LocalDate.of(year,month,day).plusDays(1); //최근 1주간 유저가 먹은 음식들의 날짜별 HashMap HashMap> nutritionSumOfUserByWeek = getNutritionSumByDateMap(userId, currentDate.minusWeeks(1), currentDate); @@ -433,7 +433,7 @@ private void validateFavoriteFood(Long favoriteFoodId, Long userId) { // 1주일동안 먹은 음식들의 영양성분 총합을 요일을 Key로 한 Map을 통해 반환 private HashMap> getNutritionSumByDateMap(Long userId, LocalDate startDate, LocalDate endDate) { HashMap> maps = new HashMap<>(); - List foodList = foodRepository.findAllByUserIdAndDateBetweenOrderByAddedTimeAsc(userId, startDate.plusDays(1), endDate.plusDays(1)); + List foodList = foodRepository.findAllByUserIdAndDateBetweenOrderByAddedTimeAsc(userId, startDate, endDate); for (Food food : foodList) { if (maps.containsKey(food.getDate())) { maps.get(food.getDate()).add(food.getBaseNutrition());