Skip to content

Commit

Permalink
Merge pull request #187 from 8attery/feat/40-project
Browse files Browse the repository at this point in the history
Fix(#171-battery): 수면 내역 조회 today 수정
  • Loading branch information
hojeong2747 authored May 25, 2023
2 parents de11be1 + 7492fa5 commit b68edf8
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,6 @@ public List<SleepResponseDto> 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()) {
Expand All @@ -294,6 +282,19 @@ public List<SleepResponseDto> 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;
Expand Down

0 comments on commit b68edf8

Please sign in to comment.