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
Tatuya Kamada
gitlab-ce
Commits
f99744d0
Commit
f99744d0
authored
Oct 18, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use join instead of subquery on Label.unprioritized scope
parent
4c924107
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
app/models/label.rb
app/models/label.rb
+8
-1
No files found.
app/models/label.rb
View file @
f99744d0
...
@@ -39,7 +39,14 @@ class Label < ActiveRecord::Base
...
@@ -39,7 +39,14 @@ class Label < ActiveRecord::Base
end
end
def
self
.
unprioritized
(
project
)
def
self
.
unprioritized
(
project
)
where
.
not
(
id:
prioritized
(
project
).
select
(
:id
))
labels
=
Label
.
arel_table
priorities
=
LabelPriority
.
arel_table
label_priorities
=
labels
.
join
(
priorities
,
Arel
::
Nodes
::
OuterJoin
).
on
(
labels
[
:id
].
eq
(
priorities
[
:label_id
]).
and
(
priorities
[
:project_id
].
eq
(
project
.
id
))).
join_sources
joins
(
label_priorities
).
where
(
priorities
[
:priority
].
eq
(
nil
))
end
end
def
self
.
left_join_priorities
def
self
.
left_join_priorities
...
...
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