Skip to content
Extraits de code Groupes Projets
Valider 1102ed57 rédigé par aya zouity's avatar aya zouity
Parcourir les fichiers

Enhance item filtering by excluding deleted items based on status and source

parent 9882a82c
Branches
1 requête de fusion!118VS-70/Excluding deleted items based on status and source
Pipeline #14439 réussi avec les étapes
in 1 minute et 39 secondes
......@@ -24,6 +24,8 @@
### Added
- MYD-739/Fix List with sale sessions stats
- Add delete item functionality in back office and display sale session ID
- Enhance item filtering by excluding deleted items based on status and source
### Changed
......
......@@ -76,9 +76,8 @@ public interface CartRepository extends JpaRepository<Cart, Long>, JpaSpecificat
List<Object[]> findActiveClientsCountByDay(LocalDateTime startDate,
LocalDateTime endDate,
ItemSource source);
@Query("SELECT c FROM Cart c " +
"WHERE EXISTS (SELECT ic1 FROM c.items ic1) " +
"WHERE EXISTS (SELECT ic1 FROM c.items ic1 WHERE ic1.status != 'DELETED_BO' ) " +
" AND LOWER(c.status) = 'open' " +
" AND ((-1L) in :clientIds OR c.clientId IN :clientIds) " +
" AND ((-1L) in :productIds OR EXISTS (SELECT ic2 FROM c.items ic2 WHERE ic2.productId IN :productIds))")
......
......@@ -1036,11 +1036,15 @@ public class CartServiceImp implements CartService {
}
});
}
List<ProductDetailsCartDTO> productDetailsCartDTOS = cart.getItems().stream()
.map(item -> mapItemToProductDetails(item, productMap))
.filter(Objects::nonNull)
.filter(item -> !item.getStatus().equals(ItemCartStatus.DELETED_BO))
.filter(item -> !(item.getStatus().equals(ItemCartStatus.DELETED_SITE) && item.getSource().equals(ItemSource.WEB)))
.toList();
cartDTO.setSubTotalPrice(productDetailsCartDTOS.stream()
.mapToDouble(ProductDetailsCartDTO::getTotalPrice)
.sum());
......
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter