Skip to content
Extraits de code Groupes Projets
Valider 69828f5c rédigé par anas elhaddad's avatar anas elhaddad
Parcourir les fichiers

fix item count

parent 35c783b4
Branches
1 requête de fusion!111Fix/item count
Pipeline #11382 réussi avec les étapes
in 53 secondes
### Added
- New features that have been added.
### Changed
- Changes in existing functionality.
### Deprecated
- Soon-to-be removed features.
### Removed
- Features that have been removed.
### Fixed
- fix item count
### Security
- Any security improvements.
## [1.0.70-RELEASE]
### Added
- Added a method to verify cart consistency with the database.
......
......@@ -981,7 +981,7 @@ public class CartServiceImp implements CartService {
throws TechnicalException {
List<ClientDTO> clients = (keyword != null && !keyword.isBlank())
? externalApiService.getClientsByKeyword(keyword)
: Collections.emptyList();
: Collections.emptyList() ;
List<ProductCartDTO> products = (productKeyword != null && !productKeyword.isBlank())
? productStockService.getProductByKeyword(productKeyword)
: Collections.emptyList();
......@@ -993,10 +993,10 @@ public class CartServiceImp implements CartService {
.map(ProductCartDTO::getProductId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (clientIds.isEmpty()) {
if (clientIds.isEmpty() && keyword == null || keyword.isBlank()) {
clientIds = List.of(-1L);
}
if (productIds.isEmpty()) {
if (productIds.isEmpty() && productKeyword == null || productKeyword.isBlank()) {
productIds = List.of(-1L);
}
Map<Long, ClientDTO> clientMap = clients.stream()
......@@ -1041,6 +1041,7 @@ public class CartServiceImp implements CartService {
.mapToDouble(ProductDetailsCartDTO::getTotalPrice)
.sum());
cartDTO.setClientDTO(clientDTO);
cartDTO.setItemsCount(productDetailsCartDTOS.size());
cartDTO.setProductDetailsCartDTOS(productDetailsCartDTOS);
return cartDTO;
});
......
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