From 2bc36a1c6a94e6a561ec7c802dafc0af286026fe Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Tue, 28 Nov 2023 23:18:02 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20fix:=20=ED=98=84=EC=9E=AC=20=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=EA=B9=8C=EC=A7=80=20=ED=8F=AC=ED=95=A8=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20(#125)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/diareat/diareat/food/service/FoodService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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());