Module: Gitlab::CycleAnalytics::SummaryHelper

Included in:
Gitlab::CycleAnalytics::Summary::DeploymentFrequency
Defined in:
lib/gitlab/cycle_analytics/summary_helper.rb

Instance Method Summary collapse

Instance Method Details

#days(from, to) ⇒ Object


14
15
16
# File 'lib/gitlab/cycle_analytics/summary_helper.rb', line 14

def days(from, to)
  [(to.end_of_day - from.beginning_of_day).fdiv(1.day), 1].max
end

#frequency(count, from, to) ⇒ Object


6
7
8
9
10
11
12
# File 'lib/gitlab/cycle_analytics/summary_helper.rb', line 6

def frequency(count, from, to)
  return Summary::Value::None.new if count == 0

  freq = (count / days(from, to)).round(1)

  Summary::Value::Numeric.new(freq)
end