From 7492fa53087eedbb98ece90386ba46024f9ec0a6 Mon Sep 17 00:00:00 2001 From: hojeong2747 Date: Thu, 25 May 2023 21:47:44 +0900 Subject: [PATCH] =?UTF-8?q?Fix(#171-battery):=20=EC=88=98=EB=A9=B4=20?= =?UTF-8?q?=EB=82=B4=EC=97=AD=20=EC=A1=B0=ED=9A=8C=20today=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/battery/BatteryService.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/_8attery/seesaw/service/battery/BatteryService.java b/src/main/java/com/_8attery/seesaw/service/battery/BatteryService.java index 7f919a9..db4618f 100644 --- a/src/main/java/com/_8attery/seesaw/service/battery/BatteryService.java +++ b/src/main/java/com/_8attery/seesaw/service/battery/BatteryService.java @@ -259,18 +259,6 @@ public List getUserSleep(Long userId, Integer year, Integer mo int todayDay = date.getDayOfMonth(); // Extract the day of the month for (SleepResponseDto sleepRes : res) { - Integer curSleep = batteryRepository.findUserCurSleep(userId); - if (todayDay == sleepRes.getDay() && curSleep != null) { - sleepRes.setSleep(curSleep); - // 오늘 수면량 입력했으면 따로 확인 - if (curSleep < sleepGoal * 0.5) { - sleepRes.setColor(3); - } else if (curSleep < sleepGoal && curSleep >= sleepGoal * 0.5) { - sleepRes.setColor(2); - } else if (curSleep >= sleepGoal) { - sleepRes.setColor(1); - } - } for (SleepDto result : resultList) { if (result.getDay() == sleepRes.getDay()) { @@ -294,6 +282,19 @@ public List getUserSleep(Long userId, Integer year, Integer mo } } } + + Integer curSleep = batteryRepository.findUserCurSleep(userId); + if (todayDay == sleepRes.getDay() && curSleep != null) { + sleepRes.setSleep(curSleep); + // 오늘 수면량 입력했으면 따로 확인 + if (curSleep < sleepGoal * 0.5) { + sleepRes.setColor(3); + } else if (curSleep < sleepGoal && curSleep >= sleepGoal * 0.5) { + sleepRes.setColor(2); + } else if (curSleep >= sleepGoal) { + sleepRes.setColor(1); + } + } } return res;