diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /lib/gitlab/analytics/cycle_analytics/records_fetcher.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
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 |