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
243b9371
Commit
243b9371
authored
Feb 16, 2021
by
Mario Celi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for negated weight filtering in IssueFinder
parent
aeed0dfa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
ee/app/finders/ee/issues_finder.rb
ee/app/finders/ee/issues_finder.rb
+7
-0
ee/app/models/ee/issue.rb
ee/app/models/ee/issue.rb
+1
-0
ee/spec/finders/issues_finder_spec.rb
ee/spec/finders/issues_finder_spec.rb
+8
-0
No files found.
ee/app/finders/ee/issues_finder.rb
View file @
243b9371
...
...
@@ -88,10 +88,17 @@ module EE
def
filter_negated_items
(
items
)
items
=
by_negated_epic
(
items
)
items
=
by_negated_iteration
(
items
)
items
=
by_negated_weight
(
items
)
super
(
items
)
end
def
by_negated_weight
(
items
)
return
items
unless
not_params
[
:weight
].
present?
items
.
without_weights
(
not_params
[
:weight
])
end
def
by_negated_epic
(
items
)
return
items
unless
not_params
[
:epic_id
].
present?
...
...
ee/app/models/ee/issue.rb
View file @
243b9371
...
...
@@ -25,6 +25,7 @@ module EE
scope
:order_status_page_published_last
,
->
{
includes
(
:status_page_published_incident
).
order
(
'status_page_published_incidents.id ASC NULLS FIRST'
)
}
scope
:order_sla_due_at_asc
,
->
{
includes
(
:issuable_sla
).
order
(
'issuable_slas.due_at ASC NULLS LAST'
)
}
scope
:order_sla_due_at_desc
,
->
{
includes
(
:issuable_sla
).
order
(
'issuable_slas.due_at DESC NULLS LAST'
)
}
scope
:without_weights
,
->
(
weights
)
{
where
(
weight:
nil
).
or
(
where
.
not
(
weight:
weights
))
}
scope
:no_epic
,
->
{
left_outer_joins
(
:epic_issue
).
where
(
epic_issues:
{
epic_id:
nil
})
}
scope
:any_epic
,
->
{
joins
(
:epic_issue
)
}
scope
:in_epics
,
->
(
epics
)
{
joins
(
:epic_issue
).
where
(
epic_issues:
{
epic_id:
epics
})
}
...
...
ee/spec/finders/issues_finder_spec.rb
View file @
243b9371
...
...
@@ -37,6 +37,14 @@ RSpec.describe IssuesFinder do
expect
(
issues
).
to
contain_exactly
(
issue_with_weight_42
)
end
end
context
'filer issues by negated weight'
do
let
(
:params
)
{
{
not:
{
weight:
1
}
}
}
it
'filters out issues with the specified weight'
do
expect
(
issues
).
to
contain_exactly
(
issue1
,
issue2
,
issue3
,
issue4
,
issue5
,
issue_with_weight_42
)
end
end
end
context
'filtering by assignee IDs'
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