Skip to content

Commit

Permalink
fix : Home API 에서 신청마감일이 가까운 정책이 없을 때, error 발생 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
LHS-11 committed Jan 5, 2024
1 parent d9b8ef1 commit 92bfedb
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ public HomeInfoResponseDto getHomeInfo(User user) {
LocalDate currentTime = LocalDate.now();
List<HomeInfoResponseDto.HomePolicyInfo> endDateHomePolicyInfoList = Arrays.stream(SupportPolicyType.values())
.map(type -> {
Policy findPolicy = policyRepository.findMostImminentNonAppliedPolicy(user.getUserId(), type, currentTime, PageRequest.of(0, 1)).get(0);
List<Policy> nonAppliedPolicy = policyRepository.findMostImminentNonAppliedPolicy(user.getUserId(), type, currentTime, PageRequest.of(0, 1));
Policy findPolicy = null;
if (nonAppliedPolicy.size() == 0) {
findPolicy = policyRepository.findAllBySupportPolicyTypesContains(type).get(0);
}
if (nonAppliedPolicy.size() != 0) {
findPolicy = nonAppliedPolicy.get(0);
}
HomeInfoResponseDto.HomePolicyInfo homePolicyInfo = HomeInfoResponseDto.HomePolicyInfo.builder()
.policyId(findPolicy.getId())
.policyName(findPolicy.getPolicyName())
Expand Down

0 comments on commit 92bfedb

Please sign in to comment.