From 5d88a85c35a95a9ab10597e97a4a701cebab3b35 Mon Sep 17 00:00:00 2001 From: hawardShin Date: Mon, 7 Oct 2024 14:40:18 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=ED=95=B4=EB=8B=B9=20=EB=8B=AC=EC=9D=98?= =?UTF-8?q?=20=EA=B2=BD=EC=9A=B0=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=EA=B0=80=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mejaigg/matchstreak/service/StreakService.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/mejai/mejaigg/matchstreak/service/StreakService.java b/src/main/java/mejai/mejaigg/matchstreak/service/StreakService.java index f47950d..5df91f9 100644 --- a/src/main/java/mejai/mejaigg/matchstreak/service/StreakService.java +++ b/src/main/java/mejai/mejaigg/matchstreak/service/StreakService.java @@ -77,9 +77,13 @@ public List 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); @@ -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)