debian-mirror-gitlab/lib/gitlab/cycle_analytics/summary/issue.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
942 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module Gitlab
module CycleAnalytics
module Summary
class Issue < Base
2021-09-04 01:27:46 +05:30
def initialize(project:, options:, current_user:)
2017-08-17 22:00:37 +05:30
@project = project
2021-09-04 01:27:46 +05:30
@options = options
2017-08-17 22:00:37 +05:30
@current_user = current_user
end
2022-04-04 11:22:00 +05:30
def identifier
:issues
end
2017-08-17 22:00:37 +05:30
def title
2020-06-23 00:09:42 +05:30
n_('New Issue', 'New Issues', value.to_i)
2017-08-17 22:00:37 +05:30
end
def value
2020-05-24 23:13:21 +05:30
@value ||= Value::PrettyNumeric.new(issues_count)
end
private
def issues_count
IssuesFinder
2021-09-04 01:27:46 +05:30
.new(@current_user, finder_params)
2020-05-24 23:13:21 +05:30
.execute
.count
2017-08-17 22:00:37 +05:30
end
2021-09-04 01:27:46 +05:30
def finder_params
@options.dup.tap do |hash|
hash[:created_after] = hash.delete(:from)
hash[:created_before] = hash.delete(:to)
hash[:project_id] = @project.id
end
end
2017-08-17 22:00:37 +05:30
end
end
end
end