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
71ed81e0
Commit
71ed81e0
authored
Jun 16, 2020
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to order by blocking issues count
Allow to order issues by the number of other issues they are blocking.
parent
e4695080
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
ee/app/models/ee/issue.rb
ee/app/models/ee/issue.rb
+2
-0
ee/spec/models/issue_spec.rb
ee/spec/models/issue_spec.rb
+12
-0
No files found.
ee/app/models/ee/issue.rb
View file @
71ed81e0
...
@@ -17,6 +17,7 @@ module EE
...
@@ -17,6 +17,7 @@ module EE
include
WeightEventable
include
WeightEventable
include
HealthStatus
include
HealthStatus
scope
:order_blocking_issues_desc
,
->
{
reorder
(
blocking_issues_count: :desc
)
}
scope
:order_weight_desc
,
->
{
reorder
::
Gitlab
::
Database
.
nulls_last_order
(
'weight'
,
'DESC'
)
}
scope
:order_weight_desc
,
->
{
reorder
::
Gitlab
::
Database
.
nulls_last_order
(
'weight'
,
'DESC'
)
}
scope
:order_weight_asc
,
->
{
reorder
::
Gitlab
::
Database
.
nulls_last_order
(
'weight'
)
}
scope
:order_weight_asc
,
->
{
reorder
::
Gitlab
::
Database
.
nulls_last_order
(
'weight'
)
}
scope
:no_epic
,
->
{
left_outer_joins
(
:epic_issue
).
where
(
epic_issues:
{
epic_id:
nil
})
}
scope
:no_epic
,
->
{
left_outer_joins
(
:epic_issue
).
where
(
epic_issues:
{
epic_id:
nil
})
}
...
@@ -204,6 +205,7 @@ module EE
...
@@ -204,6 +205,7 @@ module EE
override
:sort_by_attribute
override
:sort_by_attribute
def
sort_by_attribute
(
method
,
excluded_labels:
[])
def
sort_by_attribute
(
method
,
excluded_labels:
[])
case
method
.
to_s
case
method
.
to_s
when
'blocking_issues_desc'
then
order_blocking_issues_desc
.
with_order_id_desc
when
'weight'
,
'weight_asc'
then
order_weight_asc
.
with_order_id_desc
when
'weight'
,
'weight_asc'
then
order_weight_asc
.
with_order_id_desc
when
'weight_desc'
then
order_weight_desc
.
with_order_id_desc
when
'weight_desc'
then
order_weight_desc
.
with_order_id_desc
else
else
...
...
ee/spec/models/issue_spec.rb
View file @
71ed81e0
...
@@ -358,6 +358,18 @@ RSpec.describe Issue do
...
@@ -358,6 +358,18 @@ RSpec.describe Issue do
end
end
end
end
end
end
context
'by blocking issues'
do
it
'orders by descending blocking issues count'
do
issue_1
=
create
(
:issue
,
blocking_issues_count:
3
)
issue_2
=
create
(
:issue
,
blocking_issues_count:
2
)
results
=
described_class
.
sort_by_attribute
(
'blocking_issues_desc'
)
expect
(
results
.
first
).
to
eq
(
issue_1
)
expect
(
results
.
second
).
to
eq
(
issue_2
)
end
end
end
end
describe
'#weight'
do
describe
'#weight'
do
...
...
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