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

data_collector.rb « cycle_analytics « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 544fd17f3c545c2c2786ca6c35d1fdfcb6a0e2c6 (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
# frozen_string_literal: true

module Gitlab
  module CycleAnalytics
    # Arguments:
    #   stage - an instance of CycleAnalytics::ProjectStage or CycleAnalytics::GroupStage
    #   params:
    #     current_user: an instance of User
    #     from: DateTime
    #     to: DateTime
    #     project_ids: array of integers, optional, filtering projects within a group, used when the stage is a CycleAnalytics::GroupStage
    class DataCollector
      def initialize(stage, params = {})
        @stage = stage
        @params = params
      end

      def records_fetcher
        RecordsFetcher.new(stage: stage, query: query, params: params)
      end

      def median
        Median.new(stage: stage, query: query)
      end

      private

      attr_reader :stage, :params

      def query
        BaseQueryBuilder.new(stage: stage, params: params).apply
      end
    end
  end
end