Commit 7c4abeb8 authored by Felix Schäfer's avatar Felix Schäfer

Correct filters for int,float custom fields. #498

parent 63d82643
......@@ -587,9 +587,17 @@ class Query < ActiveRecord::Base
sql = "#{db_table}.#{db_field} IS NOT NULL"
sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
when ">="
sql = "#{db_table}.#{db_field} >= #{value.first.to_i}"
if is_custom_filter
sql = "#{db_table}.#{db_field} != '' AND CAST(#{db_table}.#{db_field} AS decimal(60,4)) >= #{value.first.to_f}"
else
sql = "#{db_table}.#{db_field} >= #{value.first.to_f}"
end
when "<="
sql = "#{db_table}.#{db_field} <= #{value.first.to_i}"
if is_custom_filter
sql = "#{db_table}.#{db_field} != '' AND CAST(#{db_table}.#{db_field} AS decimal(60,4)) <= #{value.first.to_f}"
else
sql = "#{db_table}.#{db_field} <= #{value.first.to_f}"
end
when "o"
sql = "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
when "c"
......@@ -629,6 +637,8 @@ class Query < ActiveRecord::Base
custom_fields.select(&:is_filter?).each do |field|
case field.field_format
when "int", "float"
options = { :type => :integer, :order => 20 }
when "text"
options = { :type => :text, :order => 20 }
when "list"
......
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