Skip to content

Commit

Permalink
style: 필요 없는 코드 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
Soyeon-Cha committed Jun 17, 2024
1 parent e97fc28 commit 977def9
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,17 @@ public void updateIngredients(Member member, List<UpdateRequestDto> updateReques
existIngs.add(0);
}

// member가 가지고 있는 ingredient들 모두에 대해서 돌아야 됨
// member가 가지고 있는 모든 ingredient들을 dto와 비교
for (int i=0; i<ingredients.size(); i++){

// ingredient 하나 붙잡고 dto 전체랑 비교시켜서 같은 거 있는지 확인
// ingredient와 같은 ingredientId를 가진 dto가 있는지 확인
for (int j=0; j<updateRequestDtos.size(); j++){
System.out.println("dto의 " + updateRequestDtos.get(j).getIngredientId()+"와 " + "member ingredient 리스트의 " + ingredients.get(i).getIngredientId() + "비교 결과");
// ingredientId가 같은 dto가 존재하면
if (Objects.equals(ingredients.get(i).getIngredientId(), updateRequestDtos.get(j).getIngredientId())){

// (existIngs 값) + 1
Integer original = existIngs.get(i);
existIngs.set(i, original+1);
System.out.println("-> ingredientId가 같은 dto 존재");

// 업데이트 할 iconId, amount 값 불러오기
Integer iconId = updateRequestDtos.get(j).getIconId();
Expand All @@ -110,9 +108,6 @@ public void updateIngredients(Member member, List<UpdateRequestDto> updateReques
ingredients.get(i).updateIngredient(icon, amount);
ingredientRepository.save(ingredients.get(i));
}
else{
System.out.println("-> 다름");
}
}
}

Expand Down

0 comments on commit 977def9

Please sign in to comment.