Skip to content

Commit

Permalink
Merge pull request #289 from ZeroFairy/develop
Browse files Browse the repository at this point in the history
update the apriori fix bug
  • Loading branch information
vianneynara authored Dec 18, 2024
2 parents 7082e7f + 60f97cb commit fb9046e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ public interface ProductRepository extends JpaRepository<Product, Long>, JpaSpec

List<Product> findAllByCategoryIsAndNameLikeIgnoreCase(Product.Category category, String name);

@Query("SELECT p.productId FROM Product p")
List<Long> findAllIds();

@Query("SELECT p.productId FROM Product p WHERE p.available=TRUE")
List<Long> findAllAvailableIds();
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private List<ProductDto> oldRecommender(Long productId, Boolean addRandom) {
private Long addOneRandom(Long productId, Set<Long> excludeSet) {
excludeSet.add(productId);

List<Long> allProductIds = productRepository.findAllIds();
List<Long> allProductIds = productRepository.findAllAvailableIds();
List<Long> filteredProductIds = allProductIds.stream()
.filter(id -> !excludeSet.contains(id))
.collect(Collectors.toList());
Expand Down

0 comments on commit fb9046e

Please sign in to comment.