Skip to content

Commit

Permalink
Merge pull request #412 from softeerbootcamp-2nd/feat/recommend
Browse files Browse the repository at this point in the history
[BUG FIX] #411: 유사견적 옵션 순서 자동 sort되도록 버그수정
  • Loading branch information
tank3a committed Aug 22, 2023
2 parents 7502240 + e333a98 commit 803842d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend-recommend/recommend.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def recByApriori(body):
antecedents = set(row.antecedents)
consequents = set(row.consequents)

if antecedents.issubset(input) and len(consequents) <= 2 and not antecedents.union(consequents).issubset(input):
if antecedents.isdisjoint(input) and len(consequents) <= 2 and antecedents.union(consequents).isdisjoint(input):
key = tuple(consequents)
if key not in matching_itemsets or confidence > matching_itemsets[key]:
matching_itemsets[key] = confidence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

Expand All @@ -31,6 +32,7 @@ public HistorySearchDto(int carId, int powerTrainId, int bodyTypeId, int operati

public void addAllOption(List<Integer> optionId) {
optionIds.addAll(optionId);
Collections.sort(optionIds);
}

public String getOptionIds() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

Expand All @@ -26,6 +27,7 @@ public class QuoteService {

public HistoryShortDto findMyQuote(QuoteDataDto quoteDataDto) {
List<Integer> optionIds = quoteDataDto.getOptionIdList();
Collections.sort(optionIds);

HistorySearchDto historyData = HistorySearchDto.builder()
.carId(quoteDataDto.getCarId())
Expand All @@ -40,6 +42,7 @@ public HistoryShortDto findMyQuote(QuoteDataDto quoteDataDto) {
public List<HistoryShortDto> findTopHistory(QuoteDataDto quoteDataDto) {

List<Integer> optionIds = quoteDataDto.getOptionIdList();
Collections.sort(optionIds);

if(optionIds.isEmpty()) {
throw new InvalidDataException(ErrorCode.INVALID_PARAMETER);
Expand Down

0 comments on commit 803842d

Please sign in to comment.