2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module CycleAnalytics
|
|
|
|
module Summary
|
|
|
|
module Group
|
|
|
|
class Deploy < Group::Base
|
|
|
|
include GroupProjectsProvider
|
|
|
|
|
|
|
|
def title
|
|
|
|
n_('Deploy', 'Deploys', value)
|
|
|
|
end
|
|
|
|
|
|
|
|
def value
|
|
|
|
@value ||= find_deployments
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_deployments
|
|
|
|
deployments = Deployment.joins(:project).merge(Project.inside_path(group.full_path))
|
|
|
|
deployments = deployments.where(projects: { id: options[:projects] }) if options[:projects]
|
2019-12-26 22:10:19 +05:30
|
|
|
deployments = deployments.where("deployments.created_at > ?", options[:from])
|
|
|
|
deployments = deployments.where("deployments.created_at < ?", options[:to]) if options[:to]
|
2019-10-12 21:52:04 +05:30
|
|
|
deployments.success.count
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|