blob: 34c726b2254ee25a39a88b191a239b89c9e1c44a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# frozen_string_literal: true
module Gitlab
module Analytics
module CycleAnalytics
module StageQueryHelpers
def execute_query(query)
ActiveRecord::Base.connection.execute(query.to_sql)
end
def zero_interval
Arel::Nodes::NamedFunction.new("CAST", [Arel.sql("'0' AS INTERVAL")])
end
def round_duration_to_seconds
Arel::Nodes::Extract.new(duration, :epoch)
end
def duration
Arel::Nodes::Subtraction.new(
stage.end_event.timestamp_projection,
stage.start_event.timestamp_projection
)
end
end
end
end
end
|