Move snapshot of deleted inventories to the bottom of inventory list in report wizard [SCI-8487] (#5972)

This commit is contained in:
wandji 2023-08-11 12:37:26 +01:00 committed by GitHub
parent a5f14a8333
commit f8a3640c4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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