gitlab-org--gitlab-foss/lib/gitlab/cycle_analytics/group_projects_provider.rb
Małgorzata Ksionek 5ce4236b66 Add code review remarks
Add cr remarks

Improve specs according to the review

Fix schema

Add cr remarks

Fix naming

Add cr remarks
2019-07-23 12:01:39 +02:00

27 lines
556 B
Ruby

# frozen_string_literal: true
module Gitlab
module CycleAnalytics
module GroupProjectsProvider
def projects
group ? projects_for_group : [project]
end
def group
@group ||= options.fetch(:group, nil)
end
def project
@project ||= options.fetch(:project, nil)
end
private
def projects_for_group
projects = Project.inside_path(group.full_path)
projects = projects.where(id: options[:projects]) if options[:projects]
projects
end
end
end
end