Skip to content

Commit

Permalink
Remove duplicate products
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Nov 22, 2024
1 parent b7cfd4b commit 0f910e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions services/external/weni/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ func (s *service) Call(session flows.Session, params assets.MsgCatalogParam, log
if hasSimulation {
for _, existingProductId := range existingProductsIds {
if productRetailerID == existingProductId+"#"+sellerID {
if len(newEntry.ProductRetailerIDs) < qttProducts {
newEntry.ProductRetailerIDs = append(newEntry.ProductRetailerIDs, productRetailerID)
_, exists := productRetailerIDMap[productRetailerID]
if !exists {
if len(newEntry.ProductRetailerIDs) < qttProducts {
newEntry.ProductRetailerIDs = append(newEntry.ProductRetailerIDs, productRetailerID)
}
productRetailerIDMap[productRetailerID] = struct{}{}
}
}
}
Expand Down

0 comments on commit 0f910e1

Please sign in to comment.