mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Make product order deterministic
When products are sorted by name and two products have the same name, their order is undefined. With pagination, two pages can have a different order of products with the same name which then means that two pages can return the same product. Sorting by product id makes sure that the result is always in the same order, for every page.
This commit is contained in:
@@ -66,7 +66,7 @@ class ProductsRenderer
|
||||
.split(",").map { |id| "spree_products.primary_taxon_id=#{id} DESC" }
|
||||
.join(", ") + ", spree_products.name ASC, spree_products.id ASC"
|
||||
else
|
||||
"spree_products.name ASC"
|
||||
"spree_products.name ASC, spree_products.id"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user