Skip to content
Snippets Groups Projects

Refactor project API helpers

Merged Andreas Brandl requested to merge ab/pagination-batch-counts into master
3 files
+ 34
15
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 0
8
@@ -211,14 +211,6 @@ class BasicProjectDetails < ProjectIdentity
@@ -211,14 +211,6 @@ class BasicProjectDetails < ProjectIdentity
expose :namespace, using: 'API::Entities::NamespaceBasic'
expose :namespace, using: 'API::Entities::NamespaceBasic'
expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes
expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes
# This adds preloading to the query and executes batch counting
# Side-effect: The query will be executed during batch counting
def self.prepare!(projects_relation)
preload_relation(projects_relation).tap do |projects|
execute_batch_counting(projects)
end
end
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def self.preload_relation(projects_relation, options = {})
def self.preload_relation(projects_relation, options = {})
# Preloading tags, should be done with using only `:tags`,
# Preloading tags, should be done with using only `:tags`,
Loading