2020-07-09 15:08:59 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module RendersProjectsList
|
|
|
|
def prepare_projects_for_rendering(projects)
|
|
|
|
preload_max_member_access_for_collection(Project, projects)
|
|
|
|
|
2021-09-08 12:12:01 +00:00
|
|
|
# Call the count methods on every project, so the BatchLoader would load them all at
|
2020-07-09 15:08:59 +00:00
|
|
|
# once when the entities are rendered
|
|
|
|
projects.each(&:forks_count)
|
2021-09-08 12:12:01 +00:00
|
|
|
projects.each(&:open_issues_count)
|
2020-07-09 15:08:59 +00:00
|
|
|
|
|
|
|
projects
|
|
|
|
end
|
|
|
|
end
|