Defect #35201 » 0001-use-1-instead-of-.last-to-get-value-when-determining.patch
app/models/query.rb | ||
---|---|---|
531 | 531 |
if has_filter?(field) || !filter.remote |
532 | 532 |
options[:values] = filter.values |
533 | 533 |
if options[:values] && values_for(field) |
534 |
missing = Array(values_for(field)).select(&:present?) - options[:values].map(&:last)
|
|
534 |
missing = Array(values_for(field)).select(&:present?) - options[:values].map{|v|v[1]}
|
|
535 | 535 |
if missing.any? && respond_to?(method = "find_#{field}_filter_values") |
536 | 536 |
options[:values] += send(method, missing) |
537 | 537 |
end |
test/unit/query_test.rb | ||
---|---|---|
1560 | 1560 |
end |
1561 | 1561 |
end |
1562 | 1562 | |
1563 |
def test_available_filters_as_json_should_not_include_duplicate_assigned_to_id_values |
|
1564 |
set_language_if_valid 'en' |
|
1565 |
user = User.find_by_login 'dlopper' |
|
1566 |
with_current_user User.find(1) do |
|
1567 |
q = IssueQuery.new |
|
1568 |
q.filters = {"assigned_to_id" => {:operator => '=', :values => user.id.to_s}} |
|
1569 | ||
1570 |
filters = q.available_filters_as_json |
|
1571 |
assert_not_include [user.name, user.id.to_s], filters['assigned_to_id']['values'] |
|
1572 |
assert_include [user.name, user.id.to_s, 'active'], filters['assigned_to_id']['values'] |
|
1573 |
end |
|
1574 |
end |
|
1575 | ||
1563 | 1576 |
def test_available_filters_as_json_should_include_missing_author_id_values |
1564 | 1577 |
user = User.generate! |
1565 | 1578 |
with_current_user User.find(1) do |