2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module CycleAnalytics
|
|
|
|
module Summary
|
|
|
|
module Group
|
|
|
|
class Issue < Group::Base
|
2019-12-26 22:10:19 +05:30
|
|
|
attr_reader :group, :current_user, :options
|
2019-10-12 21:52:04 +05:30
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
def initialize(group:, current_user:, options:)
|
2019-10-12 21:52:04 +05:30
|
|
|
@group = group
|
|
|
|
@current_user = current_user
|
|
|
|
@options = options
|
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
|
|
|
n_('New Issue', 'New Issues', value)
|
|
|
|
end
|
|
|
|
|
|
|
|
def value
|
|
|
|
@value ||= find_issues
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_issues
|
2019-12-26 22:10:19 +05:30
|
|
|
issues = IssuesFinder.new(current_user, finder_params).execute
|
2019-10-12 21:52:04 +05:30
|
|
|
issues = issues.where(projects: { id: options[:projects] }) if options[:projects]
|
|
|
|
issues.count
|
|
|
|
end
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
def finder_params
|
|
|
|
{
|
|
|
|
group_id: group.id,
|
|
|
|
include_subgroups: true,
|
|
|
|
created_after: options[:from],
|
|
|
|
created_before: options[:to]
|
|
|
|
}.compact
|
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|