Skip to content

Commit

Permalink
Merge pull request #64 from Team-HMH/hotfix/#63-date-difference-logic…
Browse files Browse the repository at this point in the history
…-error

fix - 날짜 차이 구하는 로직 오류 해결
  • Loading branch information
jumining authored Jan 16, 2024
2 parents eb058e6 + 0282dc3 commit fc57a99
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public void modifyDailyChallengeStatus(Long userId, List<AppUsageTimeRequest> re
}

public DailyChallenge getTodayDailyChallengeByUserId(Long userId) {
val challenge = challengeRepository.findFirstByUserIdOrderByCreatedAtDesc(userId);
Challenge challenge = challengeRepository.findFirstByUserIdOrderByCreatedAtDesc(userId);
val startDateOfChallenge = challenge.getCreatedAt().toLocalDate();
val todayDailyChallengeIndex = (int) ChronoUnit.DAYS.between(startDateOfChallenge, LocalDateTime.now().toLocalDate());

return challenge.getDailyChallenges().get(todayDailyChallengeIndex);
}
}

0 comments on commit fc57a99

Please sign in to comment.