Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
7f2b6b11
Commit
7f2b6b11
authored
Dec 04, 2017
by
Francisco Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving query to base count service
parent
979056e9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
8 deletions
+4
-8
app/services/projects/count_service.rb
app/services/projects/count_service.rb
+4
-0
app/services/projects/forks_count_service.rb
app/services/projects/forks_count_service.rb
+0
-4
app/services/projects/open_issues_count_service.rb
app/services/projects/open_issues_count_service.rb
+0
-4
No files found.
app/services/projects/count_service.rb
View file @
7f2b6b11
...
@@ -11,6 +11,10 @@ module Projects
...
@@ -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
,
...
...
app/services/projects/forks_count_service.rb
View file @
7f2b6b11
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
...
...
app/services/projects/open_issues_count_service.rb
View file @
7f2b6b11
...
@@ -2,10 +2,6 @@ module Projects
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment