Skip to content

Commit

Permalink
fix for wrong high temperature and low temperature in forecast day datas
Browse files Browse the repository at this point in the history
  • Loading branch information
Wildog committed Apr 28, 2017
1 parent b37b8df commit f285122
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions SmileWeather/Classes/SmileWeatherData.m
Expand Up @@ -361,6 +361,20 @@ -(void)configureForecastDaysAndHourly_openweathermap:(NSArray*)object{
[forecastData addObject:forecast];
dayFlag = components.day;
}
if (dayFlag == components.day) {
SmileWeatherForecastDayData *sameDayData = [forecastData lastObject];
NSDictionary *mainDataDic = [obj objectForKey:@"main"];

SmileTemperature highTemperature = [self createTemperatureFromObject_openweathermap:[mainDataDic valueForKey:@"temp_max"]];
if (highTemperature.initialized && highTemperature.celsius > sameDayData.highTemperature.celsius) {
sameDayData.highTemperature = highTemperature;
}

SmileTemperature lowTemperature = [self createTemperatureFromObject_openweathermap:[mainDataDic valueForKey:@"temp_min"]];
if (lowTemperature.initialized && lowTemperature.celsius < sameDayData.lowTemperature.celsius) {
sameDayData.lowTemperature = lowTemperature;
}
}

//hourly data
if (idx < 13) {
Expand Down

0 comments on commit f285122

Please sign in to comment.