1024 |
1024 |
int_values = value.first.to_s.scan(/[+-]?\d+/).map(&:to_i).join(",")
|
1025 |
1025 |
if int_values.present?
|
1026 |
1026 |
if is_custom_filter
|
1027 |
|
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) IN (#{int_values}))"
|
|
1027 |
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(18,3)) IN (#{int_values}))"
|
1028 |
1028 |
else
|
1029 |
1029 |
sql = "#{db_table}.#{db_field} IN (#{int_values})"
|
1030 |
1030 |
end
|
... | ... | |
1033 |
1033 |
end
|
1034 |
1034 |
when :float
|
1035 |
1035 |
if is_custom_filter
|
1036 |
|
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5})"
|
|
1036 |
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(18,3)) BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5})"
|
1037 |
1037 |
else
|
1038 |
1038 |
sql = "#{db_table}.#{db_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}"
|
1039 |
1039 |
end
|
... | ... | |
1062 |
1062 |
sql = date_clause(db_table, db_field, parse_date(value.first), nil, is_custom_filter)
|
1063 |
1063 |
else
|
1064 |
1064 |
if is_custom_filter
|
1065 |
|
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) >= #{value.first.to_f})"
|
|
1065 |
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(18,3)) >= #{value.first.to_f})"
|
1066 |
1066 |
else
|
1067 |
1067 |
sql = "#{db_table}.#{db_field} >= #{value.first.to_f}"
|
1068 |
1068 |
end
|
... | ... | |
1072 |
1072 |
sql = date_clause(db_table, db_field, nil, parse_date(value.first), is_custom_filter)
|
1073 |
1073 |
else
|
1074 |
1074 |
if is_custom_filter
|
1075 |
|
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) <= #{value.first.to_f})"
|
|
1075 |
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(18,3)) <= #{value.first.to_f})"
|
1076 |
1076 |
else
|
1077 |
1077 |
sql = "#{db_table}.#{db_field} <= #{value.first.to_f}"
|
1078 |
1078 |
end
|
... | ... | |
1082 |
1082 |
sql = date_clause(db_table, db_field, parse_date(value[0]), parse_date(value[1]), is_custom_filter)
|
1083 |
1083 |
else
|
1084 |
1084 |
if is_custom_filter
|
1085 |
|
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value[0].to_f} AND #{value[1].to_f})"
|
|
1085 |
sql = "(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(18,3)) BETWEEN #{value[0].to_f} AND #{value[1].to_f})"
|
1086 |
1086 |
else
|
1087 |
1087 |
sql = "#{db_table}.#{db_field} BETWEEN #{value[0].to_f} AND #{value[1].to_f}"
|
1088 |
1088 |
end
|