debian-mirror-gitlab/lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb

24 lines
544 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
module Gitlab
module Graphql
module Loaders
class BatchProjectStatisticsLoader
attr_reader :project_id
def initialize(project_id)
@project_id = project_id
end
def find
2019-12-04 20:38:33 +05:30
BatchLoader::GraphQL.for(project_id).batch do |project_ids, loader|
2019-09-04 21:01:54 +05:30
ProjectStatistics.for_project_ids(project_ids).each do |statistics|
loader.call(statistics.project_id, statistics)
end
end
end
end
end
end
end