Skip to content

Commit

Permalink
#229 Refactor: 홈화면 와인 반환 개수 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongyeon0208 committed Dec 2, 2024
1 parent bb0f2fc commit 18cfbd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public List<RecommendWineDTO> findRecommendWines(Member member) {
.otherwise(0.0))
.desc()
)
.limit(10)
.limit(20)
.fetch();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ public HomeResponseDTO getHomeResponse(PrincipalDetail principalDetail) {
Member member = memberRepository.findByUsername(principalDetail.getUsername()).orElseThrow(
() -> new GeneralException(ErrorStatus.MEMBER_NOT_FOUND));

// max 20개의 추천 와인을 찾는다.
List<RecommendWineDTO> recommendWines = wineRepository.findRecommendWines(member);

// 만약 추천 와인의 수가 5개를 넘어간다면, 랜덤으로 5개의 와인만 반환한다.
if (recommendWines.size() > 5) {
Collections.shuffle(recommendWines);
recommendWines = recommendWines.subList(0, 5);
}
return HomeResponseDTO.create(member, recommendWines);
}

Expand Down

0 comments on commit 18cfbd4

Please sign in to comment.