Skip to content

Commit

Permalink
fix - #58 날짜 차이 구하는 로직 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
kseysh committed Jan 16, 2024
1 parent 7b7d282 commit 82e6f48
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ 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(LocalDateTime.now().toLocalDate(), startDateOfChallenge);

val todayDailyChallengeIndex = (int) ChronoUnit.DAYS.between(startDateOfChallenge, LocalDateTime.now().toLocalDate());
return challenge.getDailyChallenges().get(todayDailyChallengeIndex);
}
}

0 comments on commit 82e6f48

Please sign in to comment.