Skip to content

Commit

Permalink
chore - #183 index로 dailyChallenge 구하고 에러처리하는 메소드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jumining committed Jul 29, 2024
1 parent e78100d commit 8377bea
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public DailyChallenge findDailyChallengeByChallengeDateAndUserIdOrElseThrow(Loca
.orElseThrow(() -> new DailyChallengeException(DailyChallengeError.DAILY_CHALLENGE_NOT_FOUND));
}

public DailyChallenge findDailyChallengeByChallengeIdAndChallengePeriodIndex(Long challengeId, Integer challengePeriodIndex) {
public DailyChallenge findDailyChallengeByChallengePeriodIndex(Challenge challenge, Integer challengePeriodIndex) {
return Optional.ofNullable(
dailyChallengeRepository.findAllByChallengeIdOrderByChallengeDate(challengeId).get(challengePeriodIndex)
challenge.getHistoryDailyChallenges().get(challengePeriodIndex)
).orElseThrow(() -> new DailyChallengeException(DailyChallengeError.DAILY_CHALLENGE_PERIOD_INDEX_NOT_FOUND));
}

Expand Down

0 comments on commit 8377bea

Please sign in to comment.