Closed ihough closed 12 years ago
@ihough i suggest adding (you need all the funky array stuff in order to memoize false)
def number_column?
return @number_column_query[0] if @number_column_query.is_a?(Array)
@number_column_query = [model.columns_hash[name.to_s].number?]
@number_column_query[0]
end
then
if number_column?
period_position = value.rindex '.'
comma_position = value.rindex ','
if period_position and comma_position and comma_position > period_position
# uncommon euro style 1.000.000,53
value = value.delete('.').gsub(',', '.')
elsif comma_position
# more common 4,000[.00] style - still don't want the commas
value = value.delete(',')
end
end
Currently if a csv contains "1,605.33` this is imported as 1