2019-12-04 20:38:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Analytics
|
|
|
|
module CycleAnalytics
|
|
|
|
module StageEvents
|
2019-12-26 22:10:19 +05:30
|
|
|
class PlanStageStart < MetricsBasedStageEvent
|
2019-12-04 20:38:33 +05:30
|
|
|
def self.name
|
|
|
|
s_("CycleAnalyticsEvent|Issue first associated with a milestone or issue first added to a board")
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.identifier
|
|
|
|
:plan_stage_start
|
|
|
|
end
|
|
|
|
|
|
|
|
def object_type
|
|
|
|
Issue
|
|
|
|
end
|
2019-12-21 20:55:43 +05:30
|
|
|
|
|
|
|
def timestamp_projection
|
|
|
|
Arel::Nodes::NamedFunction.new('COALESCE', [
|
|
|
|
issue_metrics_table[:first_associated_with_milestone_at],
|
|
|
|
issue_metrics_table[:first_added_to_board_at]
|
|
|
|
])
|
|
|
|
end
|
|
|
|
|
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
|
|
|
def apply_query_customization(query)
|
2019-12-26 22:10:19 +05:30
|
|
|
super
|
2019-12-21 20:55:43 +05:30
|
|
|
.where(issue_metrics_table[:first_added_to_board_at].not_eq(nil).or(issue_metrics_table[:first_associated_with_milestone_at].not_eq(nil)))
|
|
|
|
.where(issue_metrics_table[:first_mentioned_in_commit_at].not_eq(nil))
|
|
|
|
end
|
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2019-12-04 20:38:33 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|