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
6e6da4bb
Commit
6e6da4bb
authored
Mar 27, 2017
by
mhasbini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize labels finder query
Optimize labels finder query when searching for a project with a group
parent
37b5b7a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
app/finders/labels_finder.rb
app/finders/labels_finder.rb
+11
-2
changelogs/unreleased/labels-finder-optimize-project.yml
changelogs/unreleased/labels-finder-optimize-project.yml
+4
-0
No files found.
app/finders/labels_finder.rb
View file @
6e6da4bb
...
@@ -20,9 +20,18 @@ class LabelsFinder < UnionFinder
...
@@ -20,9 +20,18 @@ class LabelsFinder < UnionFinder
if
project?
if
project?
if
project
if
project
label_ids
<<
project
.
group
.
labels
if
project
.
group
.
present?
if
project
.
group
.
present?
labels_table
=
Label
.
arel_table
label_ids
<<
Label
.
where
(
labels_table
[
:type
].
eq
(
'GroupLabel'
).
and
(
labels_table
[
:group_id
].
eq
(
project
.
group
.
id
)).
or
(
labels_table
[
:type
].
eq
(
'ProjectLabel'
).
and
(
labels_table
[
:project_id
].
eq
(
project
.
id
))
)
)
else
label_ids
<<
project
.
labels
label_ids
<<
project
.
labels
end
end
end
else
else
label_ids
<<
Label
.
where
(
group_id:
projects
.
group_ids
)
label_ids
<<
Label
.
where
(
group_id:
projects
.
group_ids
)
label_ids
<<
Label
.
where
(
project_id:
projects
.
select
(
:id
))
label_ids
<<
Label
.
where
(
project_id:
projects
.
select
(
:id
))
...
...
changelogs/unreleased/labels-finder-optimize-project.yml
0 → 100644
View file @
6e6da4bb
---
title
:
Optimize labels finder query when searching for a project with a group
merge_request
:
author
:
mhasbini
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