From ff588cec4037889152372baa2a23d8265b58eb7e Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 15 Jun 2023 14:26:28 +1000 Subject: [PATCH] Restore line item ordering The line item sorting by id has been replaced by sorting by completed_at time: ccb183d60b12e3f69364d12aae949348a021042a While that's a good idea, the query param to order was only defined in the client Javascript and there was no default ordering. Line items also get their completed_at date from the order. So it's the same for all items of the same order and the ordering with that group of line items was random. Now we are adding an order in addition. Items are first sorted by date and then by id if there's any ambiguity. --- app/controllers/admin/bulk_line_items_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/bulk_line_items_controller.rb b/app/controllers/admin/bulk_line_items_controller.rb index 944638c218..61d88b0c5b 100644 --- a/app/controllers/admin/bulk_line_items_controller.rb +++ b/app/controllers/admin/bulk_line_items_controller.rb @@ -12,7 +12,7 @@ module Admin @line_items = order_permissions. editable_line_items.where(order_id: orders). includes(:variant). - ransack(params[:q]).result + ransack(params[:q]).result.order(:id) @pagy, @line_items = pagy(@line_items) if pagination_required?