diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 18:38:24 +0000 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /lib/gitlab/cycle_analytics/stage_summary.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) | |
download | gitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'lib/gitlab/cycle_analytics/stage_summary.rb')
-rw-r--r-- | lib/gitlab/cycle_analytics/stage_summary.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/gitlab/cycle_analytics/stage_summary.rb b/lib/gitlab/cycle_analytics/stage_summary.rb index 9c75d4bb455..564feb0319f 100644 --- a/lib/gitlab/cycle_analytics/stage_summary.rb +++ b/lib/gitlab/cycle_analytics/stage_summary.rb @@ -14,6 +14,7 @@ module Gitlab summary = [issue_stats] summary << commit_stats if user_has_sufficient_access? summary << deploy_stats + summary << deployment_frequency_stats end private @@ -26,16 +27,32 @@ module Gitlab serialize(Summary::Commit.new(project: @project, from: @from, to: @to)) end + def deployments_summary + @deployments_summary ||= + Summary::Deploy.new(project: @project, from: @from, to: @to) + end + def deploy_stats - serialize(Summary::Deploy.new(project: @project, from: @from, to: @to)) + serialize deployments_summary + end + + def deployment_frequency_stats + serialize( + Summary::DeploymentFrequency.new( + deployments: deployments_summary.value, + from: @from, + to: @to), + with_unit: true + ) end def user_has_sufficient_access? @project.team.member?(@current_user, Gitlab::Access::REPORTER) end - def serialize(summary_object) - AnalyticsSummarySerializer.new.represent(summary_object) + def serialize(summary_object, with_unit: false) + AnalyticsSummarySerializer.new.represent( + summary_object, with_unit: with_unit) end end end |