summaryrefslogtreecommitdiff
path: root/lib/gitlab/cycle_analytics/summary/deployment_frequency.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/cycle_analytics/summary/deployment_frequency.rb')
-rw-r--r--lib/gitlab/cycle_analytics/summary/deployment_frequency.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/gitlab/cycle_analytics/summary/deployment_frequency.rb b/lib/gitlab/cycle_analytics/summary/deployment_frequency.rb
new file mode 100644
index 00000000000..436dc91bd6b
--- /dev/null
+++ b/lib/gitlab/cycle_analytics/summary/deployment_frequency.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module CycleAnalytics
+ module Summary
+ class DeploymentFrequency < Base
+ include SummaryHelper
+
+ def initialize(deployments:, from:, to: nil, project: nil)
+ @deployments = deployments
+
+ super(project: project, from: from, to: to)
+ end
+
+ def title
+ _('Deployment Frequency')
+ end
+
+ def value
+ @value ||=
+ frequency(@deployments, @from, @to || Time.now)
+ end
+
+ def unit
+ _('per day')
+ end
+ end
+ end
+ end
+end