Skip to content

Commit

Permalink
Merge pull request #89 from AndLetgo/hotfix/88
Browse files Browse the repository at this point in the history
🚑 [HOTFIX]: 랜덤 전시회 조회 로직 임시 수정
  • Loading branch information
gyehwan24 authored Jan 18, 2024
2 parents 028d7f5 + 60ef36b commit 7aac8ae
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,28 @@ public ResponseEntity<?> randomTwoExhibitions() {
while (randomId1 == randomId2)
randomId2 = (int) (Math.random() * size + 1);

Exhibition randomExhibition1 = validateExhibitionById(Long.parseLong(Integer.toString(randomId1)));
Exhibition randomExhibition2 = validateExhibitionById(Long.parseLong(Integer.toString(randomId2)));
// Exhibition randomExhibition1 = validateExhibitionById(Long.parseLong(Integer.toString(randomId1)));
// Exhibition randomExhibition2 = validateExhibitionById(Long.parseLong(Integer.toString(randomId2)));

Optional<Exhibition> exhibition1 = exhibitionRepository.findById(Long.parseLong(Integer.toString(randomId1)));
Optional<Exhibition> exhibition2 = exhibitionRepository.findById(Long.parseLong(Integer.toString(randomId2)));

while (exhibition1.isEmpty()) {
randomId1 = (int) (Math.random() * size + 1);
while (randomId1 == randomId2)
randomId1 = (int) (Math.random() * size + 1);
exhibition1 = exhibitionRepository.findById(Long.parseLong(Integer.toString(randomId1)));
}

while (exhibition2.isEmpty()) {
randomId2 = (int) (Math.random() * size + 1);
while (randomId1 == randomId2)
randomId2 = (int) (Math.random() * size + 1);
exhibition2 = exhibitionRepository.findById(Long.parseLong(Integer.toString(randomId2)));
}

Exhibition randomExhibition1 = exhibition1.get();
Exhibition randomExhibition2 = exhibition2.get();

List<ExhibitionResponseDto.RandomExhibitionRes> randomExhibitionResList = new ArrayList<>();

Expand Down

0 comments on commit 7aac8ae

Please sign in to comment.