2018-07-17 12:50:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-14 09:22:09 -04:00
|
|
|
module Projects
|
|
|
|
# Service class for getting and caching the number of forks of a project.
|
2017-11-15 09:47:10 -05:00
|
|
|
class ForksCountService < Projects::CountService
|
2017-08-17 11:21:25 -04:00
|
|
|
def cache_key_name
|
|
|
|
'forks_count'
|
2017-08-14 09:22:09 -04:00
|
|
|
end
|
2017-11-30 06:52:38 -05:00
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2017-11-30 06:52:38 -05:00
|
|
|
def self.query(project_ids)
|
2018-08-31 13:16:34 -04:00
|
|
|
ForkNetworkMember.where(forked_from_project: project_ids)
|
2017-11-30 06:52:38 -05:00
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2017-08-14 09:22:09 -04:00
|
|
|
end
|
|
|
|
end
|