2017-11-27 06:24:33 -05:00
|
|
|
module API
|
|
|
|
module ProjectsRelationBuilder
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
module ClassMethods
|
2017-11-30 06:52:38 -05:00
|
|
|
def prepare_relation(projects_relation, options = {})
|
|
|
|
projects_relation = preload_relation(projects_relation, options)
|
|
|
|
execute_batch_counting(projects_relation)
|
|
|
|
projects_relation
|
2017-11-27 06:24:33 -05:00
|
|
|
end
|
|
|
|
|
2017-11-30 06:52:38 -05:00
|
|
|
def preload_relation(projects_relation, options = {})
|
2017-12-01 13:21:04 -05:00
|
|
|
projects_relation
|
2017-11-27 06:24:33 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def forks_counting_projects(projects_relation)
|
|
|
|
projects_relation
|
|
|
|
end
|
|
|
|
|
|
|
|
def batch_forks_counting(projects_relation)
|
|
|
|
::Projects::BatchForksCountService.new(forks_counting_projects(projects_relation)).refresh_cache
|
|
|
|
end
|
|
|
|
|
|
|
|
def batch_open_issues_counting(projects_relation)
|
|
|
|
::Projects::BatchOpenIssuesCountService.new(projects_relation).refresh_cache
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute_batch_counting(projects_relation)
|
|
|
|
batch_forks_counting(projects_relation)
|
|
|
|
batch_open_issues_counting(projects_relation)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|