← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~martin-borho/ubuntu-weather-app/reboot-fix-missing-current-condition2 into lp:ubuntu-weather-app/reboot

 

Martin Borho has proposed merging lp:~martin-borho/ubuntu-weather-app/reboot-fix-missing-current-condition2 into lp:ubuntu-weather-app/reboot.

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)
  Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot): continuous-integration

For more details, see:
https://code.launchpad.net/~martin-borho/ubuntu-weather-app/reboot-fix-missing-current-condition2/+merge/255227

* Fix for missing condition text in twc current data (StandardObservation in api). 
* Conditions for twc/owm already aligned, so conditional statement simplified in LocationPane.

-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~martin-borho/ubuntu-weather-app/reboot-fix-missing-current-condition2 into lp:ubuntu-weather-app/reboot.
=== modified file 'app/data/WeatherApi.js'
--- app/data/WeatherApi.js	2015-03-21 17:41:17 +0000
+++ app/data/WeatherApi.js	2015-04-04 10:17:56 +0000
@@ -23,7 +23,7 @@
 *  Version of the response data format.
 *  Increase this number to force a refresh.
 */
-var RESPONSE_DATA_VERSION = 20150321;
+var RESPONSE_DATA_VERSION = 20150404;
 
 /**
 * Helper functions
@@ -550,9 +550,11 @@
             if(!tmpResult[today]["current"].icon && tmpResult[today]["hourly"] && tmpResult[today]["hourly"].length > 0) {
                 tmpResult[today]["current"].icon = tmpResult[today]["hourly"][0].icon;
             }
-            // if condtion text is missing, use the conditon from the first hourly forecast
-            if(tmpResult[today]["current"].condition === "-" && tmpResult[today]["hourly"] && tmpResult[today]["hourly"].length > 0) {
-                tmpResult[today]["current"].condition = tmpResult[today]["hourly"][0].condition;
+            // if condition text is missing, use the conditon from the first hourly forecast
+            if(tmpResult[today]["current"].condition === "-" || tmpResult[today]["current"].condition === undefined) {
+                if(tmpResult[today]["hourly"] && tmpResult[today]["hourly"].length > 0) {
+                    tmpResult[today]["current"].condition = tmpResult[today]["hourly"][0].condition;
+                }
             }
         }
         //

=== modified file 'app/ui/LocationPane.qml'
--- app/ui/LocationPane.qml	2015-03-13 19:23:07 +0000
+++ app/ui/LocationPane.qml	2015-04-04 10:17:56 +0000
@@ -72,7 +72,7 @@
         // set current temps and condition
         iconName = (current.icon) ? current.icon : "";
         icon = (imageMap[iconName] !== undefined) ? imageMap[iconName] : "";
-        conditionText = (current.condition.main) ? current.condition.main : current.condition; // difference TWC/OWM
+        conditionText = (current.condition !== undefined) ? current.condition : "";
         todayMaxTemp = (today[tempUnits].tempMax !== undefined) ? Math.round(today[tempUnits].tempMax).toString() + settings.tempScale: "";
         todayMinTemp = Math.round(today[tempUnits].tempMin).toString() + settings.tempScale;
         currentTemp = Math.round(current[tempUnits].temp).toString() + String("°");


Follow ups