mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Ensure results in #products_relation are DISTINCT
This commit is contained in:
@@ -9,7 +9,7 @@ class OrderCycleDistributedProducts
|
||||
end
|
||||
|
||||
def products_relation
|
||||
Spree::Product.where(id: stocked_products)
|
||||
Spree::Product.where(id: stocked_products).group("spree_products.id")
|
||||
end
|
||||
|
||||
def variants_relation
|
||||
|
||||
@@ -63,10 +63,10 @@ class ProductsRenderer
|
||||
if distributor.preferred_shopfront_taxon_order.present?
|
||||
distributor
|
||||
.preferred_shopfront_taxon_order
|
||||
.split(",").map { |id| "primary_taxon_id=#{id} DESC" }
|
||||
.join(",") + ", name ASC"
|
||||
.split(",").map { |id| "spree_products.primary_taxon_id=#{id} DESC" }
|
||||
.join(", ") + ", spree_products.name ASC"
|
||||
else
|
||||
"name ASC"
|
||||
"spree_products.name ASC"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user