diff --git a/app/models/cost_query/filter/project_id.rb b/app/models/cost_query/filter/project_id.rb index dbd24e7fa4..bf5e5ab956 100644 --- a/app/models/cost_query/filter/project_id.rb +++ b/app/models/cost_query/filter/project_id.rb @@ -10,8 +10,8 @@ class CostQuery::Filter::ProjectId < CostQuery::Filter::Base def self.available_values(user) map = [] ancestors = [] - Project.all.sort_by(&:lft).each do |project| - while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) + user.projects.all.sort_by(&:lft).each do |project| + while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) ancestors.pop end map << [project.name, project.id, ancestors.size]