From b056eb797fe8a86ed8a8fc669659883db0db1dc7 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 7 May 2021 18:28:13 +0200 Subject: [PATCH] Hide empty projects in reports editor [SCI-5691] --- app/controllers/reports_controller.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index eee4239f9..a44515395 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -510,9 +510,12 @@ class ReportsController < ApplicationController def load_visible_projects render_404 unless current_team - @visible_projects = Project.viewable_by_user( - current_user, current_team - ).select(:id, :name) + @visible_projects = Project.active + .viewable_by_user(current_user, current_team) + .joins(experiments: :my_modules) + .merge(Experiment.active) + .merge(MyModule.active) + .select(:id, :name) end def load_available_repositories