From 25d1b1ee0b2ce26398c0331b7c117d405a81597f Mon Sep 17 00:00:00 2001 From: Samer Albahra Date: Mon, 21 May 2018 20:52:18 -0500 Subject: [PATCH] Fix bug interpretting precipitation data from OpenWeatherMap --- routes/weather.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/routes/weather.js b/routes/weather.js index 0be0b31..d34c1f6 100755 --- a/routes/weather.js +++ b/routes/weather.js @@ -239,7 +239,7 @@ function getOWMWeatherData( location, callback ) { weather.temp = parseInt( data.list[ 0 ].main.temp ); weather.humidity = parseInt( data.list[ 0 ].main.humidity ); weather.wind = parseInt( data.list[ 0 ].wind.speed ); - weather.precip = data.list[ 0 ].rain ? parseFloat( data.list[ 0 ].rain[ "3h" ] ) : ""; + weather.precip = data.list[ 0 ].rain ? parseFloat( data.list[ 0 ].rain[ "3h" ] || 0 ) : ""; location = location.join( "," ); @@ -434,6 +434,8 @@ exports.getWeather = function( req, res ) { return; } + console.log( weather ); + var scale = calculateWeatherScale( adjustmentMethod, adjustmentOptions, weather ), rainDelay = -1;