if has_filter?(field) || !filter.remote
options[:values] = filter.values
if options[:values] && values_for(field)
- missing = Array(values_for(field)).select(&:present?) - options[:values].map(&:last)
+ missing = Array(values_for(field)).select(&:present?) - options[:values].map{|v| v[1]}
if missing.any? && respond_to?(method = "find_#{field}_filter_values")
options[:values] += send(method, missing)
end
end
end
+ def test_available_filters_as_json_should_not_include_duplicate_assigned_to_id_values
+ set_language_if_valid 'en'
+ user = User.find_by_login 'dlopper'
+ with_current_user User.find(1) do
+ q = IssueQuery.new
+ q.filters = {"assigned_to_id" => {:operator => '=', :values => user.id.to_s}}
+
+ filters = q.available_filters_as_json
+ assert_not_include [user.name, user.id.to_s], filters['assigned_to_id']['values']
+ assert_include [user.name, user.id.to_s, 'active'], filters['assigned_to_id']['values']
+ end
+ end
+
def test_available_filters_as_json_should_include_missing_author_id_values
user = User.generate!
with_current_user User.find(1) do