Commit 6ff6a7fe authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'filter-issues-negated-weight' into 'master'

Add support for negated weight filtering

See merge request gitlab-org/gitlab!54393
parents ce664d2f a2f6100a
......@@ -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?
......
......@@ -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 }) }
......
---
title: Add support for negated weight issue filtering
merge_request: 54393
author:
type: fixed
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment