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
iv
gitlab-ce
Commits
4ab49fab
Commit
4ab49fab
authored
Apr 22, 2016
by
Takuya Noguchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use outer join for issues ordering by milestones due.
parent
aa18cc20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+3
-2
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+2
-0
No files found.
app/models/concerns/issuable.rb
View file @
4ab49fab
...
...
@@ -35,13 +35,14 @@ module Issuable
scope
:only_opened
,
->
{
with_state
(
:opened
)
}
scope
:only_reopened
,
->
{
with_state
(
:reopened
)
}
scope
:closed
,
->
{
with_state
(
:closed
)
}
scope
:order_milestone_due_desc
,
->
{
joins
(
:milestone
).
reorder
(
'
milestones.due_date DESC, milestones.id DESC'
)
}
scope
:order_milestone_due_asc
,
->
{
joins
(
:milestone
).
reorder
(
'
milestones.due_date ASC, milestones.id ASC'
)
}
scope
:order_milestone_due_desc
,
->
{
outer_join_milestone
.
reorder
(
'milestones.due_date IS NULL ASC,
milestones.due_date DESC, milestones.id DESC'
)
}
scope
:order_milestone_due_asc
,
->
{
outer_join_milestone
.
reorder
(
'milestones.due_date IS NULL ASC,
milestones.due_date ASC, milestones.id ASC'
)
}
scope
:without_label
,
->
{
joins
(
"LEFT OUTER JOIN label_links ON label_links.target_type = '
#{
name
}
' AND label_links.target_id =
#{
table_name
}
.id"
).
where
(
label_links:
{
id:
nil
})
}
scope
:join_project
,
->
{
joins
(
:project
)
}
scope
:references_project
,
->
{
references
(
:project
)
}
scope
:non_archived
,
->
{
join_project
.
where
(
projects:
{
archived:
false
})
}
scope
:outer_join_milestone
,
->
{
joins
(
"LEFT OUTER JOIN milestones ON milestones.id =
#{
table_name
}
.milestone_id"
)
}
delegate
:name
,
:email
,
...
...
spec/features/issues_spec.rb
View file @
4ab49fab
...
...
@@ -264,12 +264,14 @@ describe 'Issues', feature: true do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
sort_value_milestone_soon
)
expect
(
first_issue
).
to
include
(
'foo'
)
expect
(
last_issue
).
to
include
(
'baz'
)
end
it
'sorts by least recently due milestone'
do
visit
namespace_project_issues_path
(
project
.
namespace
,
project
,
sort:
sort_value_milestone_later
)
expect
(
first_issue
).
to
include
(
'bar'
)
expect
(
last_issue
).
to
include
(
'baz'
)
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