summaryrefslogtreecommitdiff
path: root/lib/gitlab/cycle_analytics/summary/deploy.rb
blob: c247ef0d2a71a0904a7c2f296de799de693f7e2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module Gitlab
  module CycleAnalytics
    module Summary
      class Deploy < Base
        def title
          n_('Deploy', 'Deploys', value.to_i)
        end

        def value
          @value ||= Value::PrettyNumeric.new(deployments_count)
        end

        private

        def deployments_count
          DeploymentsFinder
            .new(project: @project, finished_after: @from, finished_before: @to, status: :success)
            .execute
            .count
        end
      end
    end
  end
end