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
b8bfe50a
Commit
b8bfe50a
authored
Sep 20, 2016
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce number of queries when calling GlobalMilestone#{labels,participants}
parent
ac347028
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
CHANGELOG
CHANGELOG
+1
-0
app/models/global_milestone.rb
app/models/global_milestone.rb
+12
-2
No files found.
CHANGELOG
View file @
b8bfe50a
...
@@ -180,6 +180,7 @@ v 8.12.0 (unreleased)
...
@@ -180,6 +180,7 @@ v 8.12.0 (unreleased)
- Clean environment variables when running git hooks
- Clean environment variables when running git hooks
- Fix Import/Export issues importing protected branches and some specific models
- Fix Import/Export issues importing protected branches and some specific models
- Fix non-master branch readme display in tree view
- Fix non-master branch readme display in tree view
- Speed-up group milestones show page
- Add UX improvements for merge request version diffs
- Add UX improvements for merge request version diffs
v 8.11.7
v 8.11.7
...
...
app/models/global_milestone.rb
View file @
b8bfe50a
...
@@ -61,11 +61,11 @@ class GlobalMilestone
...
@@ -61,11 +61,11 @@ class GlobalMilestone
end
end
def
participants
def
participants
@participants
||=
milestones
.
map
(
&
:participants
).
flatten
.
compact
.
uniq
@participants
||=
milestones
_relation
.
includes
(
:participants
)
.
map
(
&
:participants
).
flatten
.
compact
.
uniq
end
end
def
labels
def
labels
@labels
||=
GlobalLabel
.
build_collection
(
milestones
.
map
(
&
:labels
).
flatten
)
@labels
||=
GlobalLabel
.
build_collection
(
milestones
_relation
.
includes
(
:labels
)
.
map
(
&
:labels
).
flatten
)
.
sort_by!
(
&
:title
)
.
sort_by!
(
&
:title
)
end
end
...
@@ -89,4 +89,14 @@ class GlobalMilestone
...
@@ -89,4 +89,14 @@ class GlobalMilestone
end
end
end
end
end
end
private
def
milestones_relation
@milestones_relation
||=
if
milestones
.
is_a?
(
ActiveRecord
::
Relation
)
milestones
else
Milestone
.
where
(
id:
milestones
.
map
(
&
:id
))
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