Moving query to base count service
This commit is contained in:
parent
979056e964
commit
7f2b6b11bd
|
@ -11,6 +11,10 @@ module Projects
|
||||||
@project = project
|
@project = project
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def relation_for_count
|
||||||
|
self.class.query(@project.id)
|
||||||
|
end
|
||||||
|
|
||||||
def cache_key_name
|
def cache_key_name
|
||||||
raise(
|
raise(
|
||||||
NotImplementedError,
|
NotImplementedError,
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Projects
|
module Projects
|
||||||
# Service class for getting and caching the number of forks of a project.
|
# Service class for getting and caching the number of forks of a project.
|
||||||
class ForksCountService < Projects::CountService
|
class ForksCountService < Projects::CountService
|
||||||
def relation_for_count
|
|
||||||
self.class.query(@project.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def cache_key_name
|
def cache_key_name
|
||||||
'forks_count'
|
'forks_count'
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,10 +2,6 @@ module Projects
|
||||||
# Service class for counting and caching the number of open issues of a
|
# Service class for counting and caching the number of open issues of a
|
||||||
# project.
|
# project.
|
||||||
class OpenIssuesCountService < Projects::CountService
|
class OpenIssuesCountService < Projects::CountService
|
||||||
def relation_for_count
|
|
||||||
self.class.query(@project.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def cache_key_name
|
def cache_key_name
|
||||||
'open_issues_count'
|
'open_issues_count'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue