Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issue_stage_end.rb « stage_events « cycle_analytics « analytics « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c1f4436c93eebace69447edd19237d03cb3a3a3 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

module Gitlab
  module Analytics
    module CycleAnalytics
      module StageEvents
        class IssueStageEnd < MetricsBasedStageEvent
          def self.name
            PlanStageStart.name
          end

          def self.identifier
            :issue_stage_end
          end

          def object_type
            Issue
          end

          def timestamp_projection
            Arel::Nodes::NamedFunction.new('COALESCE', column_list)
          end

          override :column_list
          def column_list
            [
              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)
            super.where(issue_metrics_table[:first_added_to_board_at].not_eq(nil).or(issue_metrics_table[:first_associated_with_milestone_at].not_eq(nil)))
          end
          # rubocop: enable CodeReuse/ActiveRecord
        end
      end
    end
  end
end