Small bug fixes

This commit is contained in:
Samer Albahra
2015-07-01 00:26:07 -05:00
parent 3d6c7d6da3
commit 91b429c1dd
2 changed files with 8 additions and 2 deletions

View File

@@ -97,7 +97,7 @@ exports.getWeather = function( req, res ) {
weatherUndergroundKey = req.query.key,
outputFormat = req.query.format,
firmwareVersion = req.query.fwv,
remoteAddress = req.headers[ "x-forwarded-for" ].split(",")[0] || req.connection.remoteAddress,
remoteAddress = req.headers[ "x-forwarded-for" ] || req.connection.remoteAddress,
weather = {},
// After the location is resolved, this function will run to complete the weather request
@@ -161,7 +161,7 @@ exports.getWeather = function( req, res ) {
rh = weather.observation.imperial.rh || 0,
// The absolute precipitation in the past 48 hours
precip = weather.observation.imperial.precip_2day;
precip = weather.observation.imperial.precip_2day || weather.observation.imperial.precip_24hour;
if ( typeof temp !== "number" ) {
@@ -218,6 +218,8 @@ exports.getWeather = function( req, res ) {
return false;
};
remoteAddress = remoteAddress.split(",")[0];
// Parse weather adjustment options
try {