debian-mirror-gitlab/app/services/projects/forks_count_service.rb

17 lines
431 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
module Projects
# Service class for getting and caching the number of forks of a project.
2018-03-17 18:26:18 +05:30
class ForksCountService < Projects::CountService
def cache_key_name
'forks_count'
2017-09-10 17:25:29 +05:30
end
2018-12-05 23:21:45 +05:30
# rubocop: disable CodeReuse/ActiveRecord
2018-03-17 18:26:18 +05:30
def self.query(project_ids)
2018-12-13 13:39:08 +05:30
ForkNetworkMember.where(forked_from_project: project_ids)
2017-09-10 17:25:29 +05:30
end
2018-12-05 23:21:45 +05:30
# rubocop: enable CodeReuse/ActiveRecord
2017-09-10 17:25:29 +05:30
end
end