mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix order of line item based report rows
The orders_and_fulfillment_spec would sometimes fail when the database would return line items in a different order than they were created. Without specific `order` clause the order of rows can be random. The additional sorting may lead to more server load but also ensures more consistent results for users.
This commit is contained in:
@@ -17,7 +17,7 @@ module Reporting
|
||||
|
||||
def list(line_item_includes = [variant: [:supplier, :product]])
|
||||
line_items = order_permissions.visible_line_items.in_orders(orders.result)
|
||||
.order("supplier.name", "product.name", "variant.display_name")
|
||||
.order("supplier.name", "product.name", "variant.display_name", "variant.unit_description")
|
||||
|
||||
if @params[:supplier_id_in].present?
|
||||
line_items = line_items.supplied_by_any(@params[:supplier_id_in])
|
||||
|
||||
Reference in New Issue
Block a user