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
c5a89b35
Commit
c5a89b35
authored
Dec 01, 2017
by
Francisco Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using map to retrieve the element ids because of some issues with mysql
parent
3dc331c6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
app/services/projects/batch_count_service.rb
app/services/projects/batch_count_service.rb
+3
-2
app/services/projects/batch_forks_count_service.rb
app/services/projects/batch_forks_count_service.rb
+3
-1
app/services/projects/batch_open_issues_count_service.rb
app/services/projects/batch_open_issues_count_service.rb
+3
-1
No files found.
app/services/projects/batch_count_service.rb
View file @
c5a89b35
# Service class for getting and caching the number of elements of several projects
# Warning: do not user this service with a really large set of projects
# because the service use maps to retrieve the project ids.
module
Projects
module
Projects
class
BatchCountService
class
BatchCountService
def
initialize
(
projects
)
def
initialize
(
projects
)
...
@@ -14,8 +17,6 @@ module Projects
...
@@ -14,8 +17,6 @@ module Projects
end
end
def
project_ids
def
project_ids
return
@projects
if
@projects
.
is_a?
(
ActiveRecord
::
Relation
)
@projects
.
map
(
&
:id
)
@projects
.
map
(
&
:id
)
end
end
...
...
app/services/projects/batch_forks_count_service.rb
View file @
c5a89b35
# Service class for getting and caching the number of forks of several projects
# Warning: do not user this service with a really large set of projects
# because the service use maps to retrieve the project ids
module
Projects
module
Projects
# Service class for getting and caching the number of forks of several projects
class
BatchForksCountService
<
Projects
::
BatchCountService
class
BatchForksCountService
<
Projects
::
BatchCountService
def
global_count
def
global_count
@global_count
||=
begin
@global_count
||=
begin
...
...
app/services/projects/batch_open_issues_count_service.rb
View file @
c5a89b35
# Service class for getting and caching the number of issues of several projects
# Warning: do not user this service with a really large set of projects
# because the service use maps to retrieve the project ids
module
Projects
module
Projects
# Service class for getting and caching the number of forks of several projects
class
BatchOpenIssuesCountService
<
Projects
::
BatchCountService
class
BatchOpenIssuesCountService
<
Projects
::
BatchCountService
def
global_count
def
global_count
@global_count
||=
begin
@global_count
||=
begin
...
...
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