Vote #77736
完了Filter on issue ID with between/lesser/greater operator does not work
0%
説明
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:
!list_of_issues.PNG!
Query result should show IDs 5 to 10:
!list_greater_id_five.PNG!
Query result should show IDs 6 to 8:
!list_range_id_six_to_eight.PNG!
journals
This should work.
app/models/issue_query.rb
<pre><code class="ruby">
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
</code></pre>
--------------------------------------------------------------------------------
I confirmed the problem and dee cay's fix (#23596#note-1) works fine.
This is a patch made from dee cay's post: attachment:defect-23596.diff
Setting target version to 3.3.1.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Slightly different fix applied in r15751, thanks for pointing this out.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
related_issues
relates,Closed,4806,Filter the issue list by issue ids