From 184c49a3c7261e6ef93245b8405f382322c721e6 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:47:57 +0100 Subject: [PATCH] Include secondary order of merge requests --- app/controllers/organisations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 04e100ce6..9506cf745 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -18,7 +18,7 @@ class OrganisationsController < ApplicationController @pagy, @organisations = pagy(filtered_collection(all_organisations.visible, search_term)) @merge_requests = MergeRequest.visible .joins("LEFT JOIN organisations ON organisations.id = merge_requests.absorbing_organisation_id") - .order("organisations.name") + .order(Arel.sql("organisations.name, merge_requests.merge_date IS NULL, merge_requests.merge_date DESC")) @searched = search_term.presence @total_count = all_organisations.visible.size end