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

module Gitlab
  module CycleAnalytics
    module Summary
      class Deploy < Base
        include Gitlab::Utils::StrongMemoize

        def title
          n_('Deploy', 'Deploys', value)
        end

        def value
          strong_memoize(:value) do
            query = @project.deployments.success.where("created_at >= ?", @from)
            query = query.where("created_at <= ?", @to) if @to
            query.count
          end
        end
      end
    end
  end
end