Skip to content

Commit

Permalink
edit : HCCUP 추천 전략 로직 수정 #138
Browse files Browse the repository at this point in the history
  • Loading branch information
bongsh0112 committed Feb 5, 2024
1 parent 29c1bae commit af72150
Showing 1 changed file with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public List<Product> recommendation(Long userId, String categoryName) {
productList.addAll(
filterStep(CATEGORY_NAME, recommendationDTO.get(0).getAnswer().split(", ")[0]));
productList.addAll(
filterStep(CATEGORY_NAME, recommendationDTO.get(0).getAnswer().split(", ")[1]));
filterStep(CATEGORY_NAME, recommendationDTO.get(0).getAnswer().split(", ")[1])
.stream()
.filter(product -> !productList.contains(product))
.toList());
} else {
productList.addAll(filterStep(CATEGORY_NAME, recommendationDTO.get(0).getAnswer()));
}
Expand All @@ -47,16 +50,16 @@ public List<Product> recommendation(Long userId, String categoryName) {
if (splitAnswer.length > 1) {
filteredProductList =
productList.stream()
.filter(product -> product.getCharacteristic().contains(splitAnswer[0]))
.filter(product -> product.getCharacteristic().contains(splitAnswer[1]))
.filter(
product ->
product.getCharacteristic().contains(splitAnswer[0])
|| product.getCharacteristic()
.contains(splitAnswer[1]))
.toList();
} else {
filteredProductList =
productList.stream()
.filter(
product ->
product.getCharacteristic()
.contains(recommendationDTO.get(1).getAnswer()))
.filter(product -> product.getCharacteristic().contains(splitAnswer[0]))
.toList();
}

Expand All @@ -72,19 +75,17 @@ public List<Product> recommendation(Long userId, String categoryName) {
.filter(
product ->
product.getCharacteristic()
.contains(
recommendationDTO
.get(2)
.getAnswer()
.split(", ")[0]))
.filter(
product ->
product.getCharacteristic()
.contains(
recommendationDTO
.get(2)
.getAnswer()
.split(", ")[1]))
.contains(
recommendationDTO
.get(2)
.getAnswer()
.split(", ")[0])
|| product.getCharacteristic()
.contains(
recommendationDTO
.get(2)
.getAnswer()
.split(", ")[1]))
.toList();
} else {
return filteredProductList.stream()
Expand Down

0 comments on commit af72150

Please sign in to comment.