Sort changesets by close time to match selection

This ensures that the sort can be optimised using the index
when selecting by time.
This commit is contained in:
Tom Hughes 2023-08-13 19:09:54 +01:00
parent f059045848
commit 702c071e19

View file

@ -172,9 +172,9 @@ module Api
# sort the changesets
changesets = if params[:order] == "oldest"
changesets.order("created_at ASC")
changesets.order(:closed_at => :asc)
else
changesets.order("created_at DESC")
changesets.order(:closed_at => :desc)
end
# limit the result