Skip to content

Commit

Permalink
Fix: 해당 달의 경우 업데이트가 안되는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Hawardshin committed Oct 7, 2024
1 parent f68a33c commit 5d88a85
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ public List<UserStreakDto> refreshStreak(UserStreakRequest request) {
} else if (history.isDone()) { //이미 검색이 끝났거나
history.setUpdatedAt(LocalDateTime.now());
} else {
String[] monthHistories = getMonthHistories(yearMonth, user.getPuuid(), 1, yearMonth.lengthOfMonth());
if (monthHistories == null || monthHistories.length == 0) // 빈 히스토리인 경우
history.setDone(true);
if (yearMonth.equals(YearMonth.now())) {
String[] monthHistories = getMonthHistories(yearMonth, user.getPuuid(), 1,
yearMonth.lengthOfMonth());
if (monthHistories == null || monthHistories.length == 0) // 빈 히스토리인 경우
history.setDone(true);
updateStreakData(history, yearMonth, user.getPuuid());
}
}
searchHistoryRepository.save(history);
return getUserStreakDtoList(history);
Expand Down Expand Up @@ -110,7 +114,8 @@ private void updateStreakData(SearchHistory history, YearMonth dateYM, String pu
int startDay = history.getLastSuccessDay();
history.setUpdatedAt(LocalDateTime.now());
if (startDay >= dateYM.lengthOfMonth()) {
searchHistoryRepository.updateIsDoneByHistoryId(history.getId(), true);
history.setDone(true);
searchHistoryRepository.save(history);
return;
}
if (startDay == 0)
Expand Down

0 comments on commit 5d88a85

Please sign in to comment.