From f8a3640c4cb274051a17fd4039723ec23decdb07 Mon Sep 17 00:00:00 2001 From: wandji Date: Fri, 11 Aug 2023 12:37:26 +0100 Subject: [PATCH] Move snapshot of deleted inventories to the bottom of inventory list in report wizard [SCI-8487] (#5972) --- app/controllers/reports_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index f33488b69..375335c03 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -323,12 +323,13 @@ class ReportsController < ApplicationController def load_wizard_vars @templates = Extends::REPORT_TEMPLATES - live_repositories = Repository.accessible_by_teams(current_team).active + live_repositories = Repository.accessible_by_teams(current_team).sort_by { |r| r.name.downcase } snapshots_of_deleted = RepositorySnapshot.left_outer_joins(:original_repository) .where(team: current_team) .where.not(original_repository: live_repositories) .select('DISTINCT ON ("repositories"."parent_id") "repositories".*') - @repositories = (live_repositories + snapshots_of_deleted).sort_by { |r| r.name.downcase } + .sort_by { |r| r.name.downcase } + @repositories = live_repositories + snapshots_of_deleted @visible_projects = current_team.projects .active .joins(experiments: :my_modules)