Project

General

Profile

Defect #5778 ยป custom_field_filter.patch

Yuki Kita, 2010-07-03 00:01

View differences:

app/models/query.rb (working copy)
114 114
                                 :date_past => [ ">t-", "<t-", "t-", "t", "w" ],
115 115
                                 :string => [ "=", "~", "!", "!~" ],
116 116
                                 :text => [  "~", "!~" ],
117
                                 :integer => [ "=", ">=", "<=", "!*", "*" ] }
117
                                 :integer => [ "=", ">=", "<=", "!*", "*" ],
118
                                 :float => [ "=", ">=", "<=", "!*", "*" ] }
118 119

  
119 120
  cattr_reader :operators_by_filter_type
120 121

  
......
519 520
      sql = "#{db_table}.#{db_field} IS NOT NULL"
520 521
      sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
521 522
    when ">="
522
      sql = "#{db_table}.#{db_field} >= #{value.first.to_i}"
523
      sql = "CAST(#{db_table}.#{db_field} AS decimal(60,3)) >= #{value.first.to_f}"
523 524
    when "<="
524
      sql = "#{db_table}.#{db_field} <= #{value.first.to_i}"
525
      sql = "CAST(#{db_table}.#{db_field} AS decimal(60,3)) <= #{value.first.to_f}"
525 526
    when "o"
526 527
      sql = "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
527 528
    when "c"
......
569 570
        options = { :type => :date, :order => 20 }
570 571
      when "bool"
571 572
        options = { :type => :list, :values => [[l(:general_text_yes), "1"], [l(:general_text_no), "0"]], :order => 20 }
573
      when "int"
574
        options = { :type => :integer, :order => 20 }
575
      when "float"
576
        options = { :type => :float, :order => 20 }
572 577
      else
573 578
        options = { :type => :string, :order => 20 }
574 579
      end
app/views/queries/_filters.rhtml (working copy)
83 83
        <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %> <%= l(:label_day_plural) %>
84 84
    <% when :string, :text %>
85 85
        <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 30, :class => "select-small" %>
86
    <% when :integer %>
86
    <% when :integer, :float %>
87 87
        <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %>
88 88
    <% end %>
89 89
    </div>
    (1-1/1)