|
@@ -35,16 +35,24 @@ module Blazer
|
|
@bind_vars.each do |var|
|
|
@bind_vars.each do |var|
|
|
value = params[var].presence
|
|
value = params[var].presence
|
|
if value
|
|
if value
|
|
|
|
+ if ["start_time", "end_time"].include?(var)
|
|
|
|
+ value = value.to_s.gsub(" ", "+") # fix for Quip bug
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+ if var.end_with?("_at")
|
|
|
|
+ begin
|
|
|
|
+ value = Blazer.time_zone.parse(value)
|
|
|
|
+ rescue
|
|
|
|
+ # do nothing
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+
|
|
if value =~ /\A\d+\z/
|
|
if value =~ /\A\d+\z/
|
|
value = value.to_i
|
|
value = value.to_i
|
|
elsif value =~ /\A\d+\.\d+\z/
|
|
elsif value =~ /\A\d+\.\d+\z/
|
|
value = value.to_f
|
|
value = value.to_f
|
|
end
|
|
end
|
|
end
|
|
end
|
|
- if var.end_with?("_at")
|
|
|
|
- value = Blazer.time_zone.parse(value) rescue nil
|
|
|
|
- end
|
|
|
|
- value.gsub!(" ", "+") if ["start_time", "end_time"].include?(var) # fix for Quip bug
|
|
|
|
statement.gsub!("{#{var}}", ActiveRecord::Base.connection.quote(value))
|
|
statement.gsub!("{#{var}}", ActiveRecord::Base.connection.quote(value))
|
|
end
|
|
end
|
|
end
|
|
end
|