Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#229 Refactor: 홈화면 와인 반환 개수 수정 #230

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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