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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7e4649af
Commit
7e4649af
authored
Dec 05, 2019
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename method to more detailed name
parent
d82fab0b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
lib/api/entities.rb
lib/api/entities.rb
+2
-2
lib/api/groups.rb
lib/api/groups.rb
+1
-1
lib/api/projects_batch_counting.rb
lib/api/projects_batch_counting.rb
+1
-1
spec/lib/api/projects_batch_counting_spec.rb
spec/lib/api/projects_batch_counting_spec.rb
+3
-3
No files found.
lib/api/entities.rb
View file @
7e4649af
...
@@ -418,7 +418,7 @@ module API
...
@@ -418,7 +418,7 @@ module API
options:
{
only_owned:
true
}
options:
{
only_owned:
true
}
).
execute
).
execute
Entities
::
Project
.
pre
pare
!
(
projects
)
Entities
::
Project
.
pre
load_and_batch_count
!
(
projects
)
end
end
expose
:shared_projects
,
using:
Entities
::
Project
do
|
group
,
options
|
expose
:shared_projects
,
using:
Entities
::
Project
do
|
group
,
options
|
...
@@ -428,7 +428,7 @@ module API
...
@@ -428,7 +428,7 @@ module API
options:
{
only_shared:
true
}
options:
{
only_shared:
true
}
).
execute
).
execute
Entities
::
Project
.
pre
pare
!
(
projects
)
Entities
::
Project
.
pre
load_and_batch_count
!
(
projects
)
end
end
end
end
...
...
lib/api/groups.rb
View file @
7e4649af
...
@@ -231,7 +231,7 @@ module API
...
@@ -231,7 +231,7 @@ module API
projects
,
options
=
with_custom_attributes
(
projects
,
options
)
projects
,
options
=
with_custom_attributes
(
projects
,
options
)
present
options
[
:with
].
pre
pare
!
(
projects
),
options
present
options
[
:with
].
pre
load_and_batch_count
!
(
projects
),
options
end
end
desc
'Get a list of subgroups in this group.'
do
desc
'Get a list of subgroups in this group.'
do
...
...
lib/api/projects_batch_counting.rb
View file @
7e4649af
...
@@ -7,7 +7,7 @@ module API
...
@@ -7,7 +7,7 @@ module API
class_methods
do
class_methods
do
# This adds preloading to the query and executes batch counting
# This adds preloading to the query and executes batch counting
# Side-effect: The query will be executed during batch counting
# Side-effect: The query will be executed during batch counting
def
pre
pare
!
(
projects_relation
)
def
pre
load_and_batch_count
!
(
projects_relation
)
preload_relation
(
projects_relation
).
tap
do
|
projects
|
preload_relation
(
projects_relation
).
tap
do
|
projects
|
execute_batch_counting
(
projects
)
execute_batch_counting
(
projects
)
end
end
...
...
spec/lib/api/projects_batch_counting_spec.rb
View file @
7e4649af
...
@@ -9,7 +9,7 @@ describe API::ProjectsBatchCounting do
...
@@ -9,7 +9,7 @@ describe API::ProjectsBatchCounting do
end
end
end
end
describe
'.pre
pare
!'
do
describe
'.pre
load_and_batch_count
!'
do
let
(
:projects
)
{
double
}
let
(
:projects
)
{
double
}
let
(
:preloaded_projects
)
{
double
}
let
(
:preloaded_projects
)
{
double
}
...
@@ -18,7 +18,7 @@ describe API::ProjectsBatchCounting do
...
@@ -18,7 +18,7 @@ describe API::ProjectsBatchCounting do
expect
(
subject
).
to
receive
(
:preload_relation
).
with
(
projects
).
and_return
(
preloaded_projects
)
expect
(
subject
).
to
receive
(
:preload_relation
).
with
(
projects
).
and_return
(
preloaded_projects
)
expect
(
subject
.
pre
pare
!
(
projects
)).
to
eq
(
preloaded_projects
)
expect
(
subject
.
pre
load_and_batch_count
!
(
projects
)).
to
eq
(
preloaded_projects
)
end
end
it
'executes batch counting'
do
it
'executes batch counting'
do
...
@@ -26,7 +26,7 @@ describe API::ProjectsBatchCounting do
...
@@ -26,7 +26,7 @@ describe API::ProjectsBatchCounting do
expect
(
subject
).
to
receive
(
:execute_batch_counting
).
with
(
preloaded_projects
)
expect
(
subject
).
to
receive
(
:execute_batch_counting
).
with
(
preloaded_projects
)
subject
.
pre
pare
!
(
projects
)
subject
.
pre
load_and_batch_count
!
(
projects
)
end
end
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