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

26 lines
536 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 Deploy < Base
def title
2020-06-23 00:09:42 +05:30
n_('Deploy', 'Deploys', 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(deployments_count)
end
private
def deployments_count
query = @project.deployments.success.where("created_at >= ?", @from)
query = query.where("created_at <= ?", @to) if @to
query.count
2017-08-17 22:00:37 +05:30
end
end
end
end
end