Defect #23596

Filter on issue ID with between/lesser/greater operator does not work

Added by JW Fuchs about 1 year ago. Updated about 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Issues filter
Target version:3.3.1
Resolution:Fixed Affected version:3.3.0

Description

Version 3.3.0 introduced the feature to filter by issues by id, including range, see #4806.

This feature does not work correctly. When a range should be displayed, only a single issue is returned.

Several issues exist in test database:

Query result should show IDs 5 to 10:

Query result should show IDs 6 to 8:

list_of_issues.PNG (20.4 KB) JW Fuchs, 2016-08-16 15:12

list_greater_id_five.PNG (13.5 KB) JW Fuchs, 2016-08-16 15:12

list_range_id_six_to_eight.PNG (13.5 KB) JW Fuchs, 2016-08-16 15:12

defect-23596.diff Magnifier - patch by dee cay (592 Bytes) Go MAEDA, 2016-08-28 15:00


Related issues

Related to Redmine - Feature #4806: Filter the issue list by issue ids Closed 2010-02-11

Associated revisions

Revision 15751
Added by Jean-Philippe Lang about 1 year ago

Filter on issue ID with between/lesser/greater operator does not work (#23596).

History

#1 Updated by dee cay about 1 year ago

This should work.

app/models/issue_query.rb

  def sql_for_issue_id_field(field, operator, value)
    ids = value.first.to_s.scan(/\d+/).map(&:to_i).join(",")

    if ids.present?
      if operator == "=" 
        "#{Issue.table_name}.id IN (#{ids})" 
      else
        sql_for_field("id", operator, value, Issue.table_name, "id")
      end
    else
      "1=0" 
    end
  end

#2 Updated by Go MAEDA about 1 year ago

  • File defect-23596.diffMagnifier added
  • Status changed from New to Confirmed
  • Priority changed from High to Normal
  • Target version set to 3.3.1

I confirmed the problem and dee cay's fix (#23596#note-1) works fine.
This is a patch made from dee cay's post: defect-23596.diff

Setting target version to 3.3.1.

#3 Updated by Toshi MARUYAMA about 1 year ago

  • Related to Feature #4806: Filter the issue list by issue ids added

#4 Updated by Jean-Philippe Lang about 1 year ago

  • Subject changed from Filter on issue ID does not work correctly to Filter on issue ID with between/lesser/greater operator does not work
  • Status changed from Confirmed to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Slightly different fix applied in r15751, thanks for pointing this out.

#5 Updated by Jean-Philippe Lang about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF