Skip to content

Commit

Permalink
Fix: 메뉴 추천 api 수정 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
hejin8307 committed May 8, 2024
1 parent 89c5bab commit 03e0aa7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/com/hanaro/starbucks/service/MenuService.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,15 @@ public List<MenuResDto> getRecommendationList(){

Random random = new Random();

while (idxSet.size() < 9) {
while (idxSet.size() < 8) {
int idx = random.nextInt(menus.size());

Menu menu = menus.get(idx);

if(idxSet.contains(idx)) continue;

if(menu.getCategory().getCategoryIdx() == 4 || menu.getCategory().getCategoryIdx() == 5) continue;

idxSet.add(idx);
menuList.add(menus.get(idx));
}
Expand Down

0 comments on commit 03e0aa7

Please sign in to comment.