diff options
Diffstat (limited to 'lib/gitlab/analytics/cycle_analytics/records_fetcher.rb')
-rw-r--r-- | lib/gitlab/analytics/cycle_analytics/records_fetcher.rb | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/gitlab/analytics/cycle_analytics/records_fetcher.rb b/lib/gitlab/analytics/cycle_analytics/records_fetcher.rb index e8e269a88f0..e7352a23b99 100644 --- a/lib/gitlab/analytics/cycle_analytics/records_fetcher.rb +++ b/lib/gitlab/analytics/cycle_analytics/records_fetcher.rb @@ -12,13 +12,11 @@ module Gitlab MAPPINGS = { Issue => { - finder_class: IssuesFinder, serializer_class: AnalyticsIssueSerializer, includes_for_query: { project: [:namespace], author: [] }, columns_for_select: %I[title iid id created_at author_id project_id] }, MergeRequest => { - finder_class: MergeRequestsFinder, serializer_class: AnalyticsMergeRequestSerializer, includes_for_query: { target_project: [:namespace], author: [] }, columns_for_select: %I[title iid id created_at author_id state_id target_project_id] @@ -56,27 +54,12 @@ module Gitlab attr_reader :stage, :query, :params - def finder_query - MAPPINGS - .fetch(subject_class) - .fetch(:finder_class) - .new(params.fetch(:current_user), finder_params.fetch(stage.parent.class)) - .execute - end - def columns MAPPINGS.fetch(subject_class).fetch(:columns_for_select).map do |column_name| subject_class.arel_table[column_name] end end - # EE will override this to include Group rules - def finder_params - { - Project => { project_id: stage.parent_id } - } - end - def default_test_stage? stage.matches_with_stage_params?(Gitlab::Analytics::CycleAnalytics::DefaultStages.params_for_test_stage) end @@ -113,8 +96,7 @@ module Gitlab end def records - results = finder_query - .merge(ordered_and_limited_query) + results = ordered_and_limited_query .select(*columns, round_duration_to_seconds.as('total_time')) # using preloader instead of includes to avoid AR generating a large column list |