Skip to content

Commit

Permalink
Fixes #38, rounding max %'s now to avoid weird float math.
Browse files Browse the repository at this point in the history
  • Loading branch information
onewheelskyward committed Jul 10, 2016
1 parent e5bd9c3 commit bbeb0d4
Show file tree
Hide file tree
Showing 4 changed files with 1,507 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lib/lita/handlers/forecasts.rb
Expand Up @@ -353,7 +353,7 @@ def do_the_daily_rain_thing(forecast)

max = get_max_by_data_key(forecast, 'hourly', 'precipProbability')

"48 hr #{precip_type}s |#{str}| max #{max.to_f * 100}%"
"48 hr #{precip_type}s |#{str}| max #{(max.to_f * 100).round}%"
end

def do_the_daily_wind_thing(forecast)
Expand Down Expand Up @@ -469,14 +469,12 @@ def do_the_windows_thing(forecast)

forecast['hourly']['data'].each_with_index do |hour, index|
tm = Time.at(hour['time']).to_datetime.strftime('%k:%M')
puts "#{hour['time']} - #{tm} - #{hour['temperature']}"

if hour['temperature'] > high_temp
high_temp = hour['temperature'].to_i
end

if hour['temperature'].to_i >= 71
puts "Setting close time to #{hour['time']}"
time_to_close_the_windows = hour['time']
window_close_temp = hour['temperature']
break
Expand Down
2 changes: 1 addition & 1 deletion lita-onewheel-forecast-io.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'lita-onewheel-forecast-io'
spec.version = '1.3.9'
spec.version = '1.3.10'
spec.authors = ['Andrew Kreps']
spec.email = ['andrew.kreps@gmail.com']
spec.description = <<-EOS
Expand Down

0 comments on commit bbeb0d4

Please sign in to comment.