Welcome to mirror list, hosted at ThFree Co, Russian Federation.

batch_forks_count_service.rb « projects « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 51fad1c12a425fe2e49e6bfd770d523e77daae89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Projects
  # Service class for getting and caching the number of forks of several projects
  class BatchForksCountService < Projects::BatchCountService
    def global_count
      @global_count ||= ForkedProjectLink.where(forked_from_project: @projects.map(&:id))
                                         .group(:forked_from_project_id)
                                         .count
    end

    def count_service
      ::Projects::ForksCountService
    end
  end
end