Skip to content

Commit

Permalink
Merge pull request #93 from Team-HMH/fix/#92-difference-days
Browse files Browse the repository at this point in the history
fix - #92 λ‚ μ§œ μˆ˜μ •
  • Loading branch information
kseysh authored Jan 19, 2024
2 parents d970d8f + 19595f1 commit 29fecd9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public record ChallengeResponse(
public static ChallengeResponse of(Challenge challenge, String os) {
List<DailyChallenge> dailyChallenges = challenge.getDailyChallenges();

int daysSinceToday = (int) ChronoUnit.DAYS.between(LocalDateTime.now().toLocalDate(),
challenge.getDailyChallenges().get(0).getCreatedAt().toLocalDate());
int daysSinceToday = (int) ChronoUnit.DAYS.between(challenge.getCreatedAt().toLocalDate(),
LocalDateTime.now().toLocalDate());
int todayIndex = daysSinceToday >= challenge.getPeriod() ? -1 : daysSinceToday;
int dailyChallengeIndex = todayIndex == -1 ? dailyChallenges.size()-1 : todayIndex;

Expand Down

0 comments on commit 29fecd9

Please sign in to comment.