Restore line item ordering

The line item sorting by id has been replaced by sorting by completed_at
time: ccb183d60b

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.
This commit is contained in:
Maikel Linke
2023-06-15 14:26:28 +10:00
committed by Konrad
parent e065910d2d
commit ff588cec40

View File

@@ -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?