Class: Gitlab::Analytics::CycleAnalytics::Average

Inherits:
Object
  • Object
show all
Includes:
StageQueryHelpers, Utils::StrongMemoize
Defined in:
lib/gitlab/analytics/cycle_analytics/average.rb

Instance Method Summary collapse

Methods included from StageQueryHelpers

#duration, #end_event_timestamp_projection, #execute_query, #in_progress?, #order_by, #requires_grouping?, #round_duration_to_seconds, #zero_interval

Constructor Details

#initialize(stage:, query:, params: {}) ⇒ Average

Returns a new instance of Average.



10
11
12
13
14
# File 'lib/gitlab/analytics/cycle_analytics/average.rb', line 10

def initialize(stage:, query:, params: {})
  @stage = stage
  @query = query
  @params = params
end

Instance Method Details

#daysObject



20
21
22
# File 'lib/gitlab/analytics/cycle_analytics/average.rb', line 20

def days
  seconds ? seconds.fdiv(1.day) : nil
end

#secondsObject



16
17
18
# File 'lib/gitlab/analytics/cycle_analytics/average.rb', line 16

def seconds
  select_average ? select_average['average'] : nil
end