2019-07-04 10:42:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module CycleAnalytics
|
|
|
|
class GroupLevel
|
2019-07-16 05:38:19 -04:00
|
|
|
include LevelBase
|
2019-07-16 11:17:21 -04:00
|
|
|
attr_reader :options, :group
|
2019-07-04 10:42:31 -04:00
|
|
|
|
2019-07-16 11:17:21 -04:00
|
|
|
def initialize(group:, options:)
|
|
|
|
@group = group
|
|
|
|
@options = options.merge(group: group)
|
2019-07-04 10:42:31 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def summary
|
2019-07-16 11:17:21 -04:00
|
|
|
@summary ||= ::Gitlab::CycleAnalytics::GroupStageSummary.new(group,
|
2019-07-04 10:42:31 -04:00
|
|
|
from: options[:from],
|
2019-07-06 16:15:13 -04:00
|
|
|
current_user: options[:current_user],
|
|
|
|
options: options).data
|
2019-07-04 10:42:31 -04:00
|
|
|
end
|
|
|
|
|
2019-07-16 11:17:21 -04:00
|
|
|
def permissions(*)
|
2019-07-04 10:42:31 -04:00
|
|
|
STAGES.each_with_object({}) do |stage, obj|
|
|
|
|
obj[stage] = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def stats
|
|
|
|
@stats ||= STAGES.map do |stage_name|
|
|
|
|
self[stage_name].as_json(serializer: GroupAnalyticsStageSerializer)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|