Skip to content

Commit

Permalink
Check for chance of snow if no chance for rain is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Aug 29, 2015
1 parent a8b426a commit 33bc80f
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -46,7 +46,13 @@ public function __get($property)
return $this->_properties->humidity;

case 'precipitation_percent':
return $this->_properties->chanceofrain;
// There is no "precipitation" field, so if we don't have
// rain, check for snow, and return 0 if we have neither.
return !empty($this->_properties->chanceofrain)
? $this->_properties->chanceofrain
: (!empty($this->_properties->chanceofsnow)
? $this->_properties->chanceofsnow
: 0);

case 'wind_gust':
if ($this->_forecast->weather->units == Horde_Service_Weather::UNITS_STANDARD) {
Expand Down

0 comments on commit 33bc80f

Please sign in to comment.