← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~martin-borho/ubuntu-weather-app/reboot-data-fixes into lp:ubuntu-weather-app/reboot

 

Martin Borho has proposed merging lp:~martin-borho/ubuntu-weather-app/reboot-data-fixes into lp:ubuntu-weather-app/reboot.

Commit message:
Some fixes related to data backend and data format: 

* added missing settings.interval value to request parameters in data client
* respect caching after adding a new location
* updated refresh interval choices to maintain netiquette (OWM/TWC): 5 min to small, should be 10min at least (TWC)
* alignment of data format for TWC/OWM for condition-phrase, updated RESPONSE_DATA_VERSION to force a refresh at start

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)

For more details, see:
https://code.launchpad.net/~martin-borho/ubuntu-weather-app/reboot-data-fixes/+merge/252207

Some fixes related to data backend and data format: 

* added missing settings.interval value to request parameters in data client
* respect caching after adding a new location
* updated refresh interval choices to maintain netiquette (OWM/TWC), 5 min to small, should be 10min at least(TWC)
* alignment of data format for TWC/OWM for condition-phrase, updated RESPONSE_DATA_VERSION to force a refresh at start
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~martin-borho/ubuntu-weather-app/reboot-data-fixes into lp:ubuntu-weather-app/reboot.
=== modified file 'app/data/WeatherApi.js'
--- app/data/WeatherApi.js	2015-02-11 04:29:28 +0000
+++ app/data/WeatherApi.js	2015-03-07 16:44:57 +0000
@@ -23,7 +23,7 @@
 *  Version of the response data format.
 *  Increase this number to force a refresh.
 */
-var RESPONSE_DATA_VERSION = 20140315;
+var RESPONSE_DATA_VERSION = 20150307;
 
 /**
 * Helper functions
@@ -233,7 +233,7 @@
             windDeg: data.wind.deg,
             windDir: calcWindDir(data.wind.deg),
             icon: _icon_map[data.weather[0].icon],
-            condition: data.weather[0]
+            condition: data.weather[0].main
         };
         if(data.id !== undefined) {
             result["service"] = _serviceName;
@@ -263,7 +263,7 @@
             pressure: data.pressure,
             humidity: data.humidity,
             icon: _icon_map[data.weather[0].icon],
-            condition: data.weather[0],
+            condition: data.weather[0].main,
             windDeg: data.deg,
             windDir: calcWindDir(data.deg),
             hourly: []
@@ -725,9 +725,10 @@
                         db: loc.db,
                         units: 'metric',
                         service: message.params.service,
-                        api_key: message.params.api_key
+                        api_key: message.params.api_key,
+                        interval: message.params.interval
                     },
-                    secsFromLastFetch = (now-loc.updated)/1000;
+                    secsFromLastFetch = (now-loc.updated)/1000;                                
                 if( message.params.force===true || loc.format !== RESPONSE_DATA_VERSION || secsFromLastFetch > params.interval){
                     // data older than 30min, location is new or data format is deprecated
                     WeatherApi.getLocationData(params, updatedHnd, onError);

=== modified file 'app/ubuntu-weather-app.qml'
--- app/ubuntu-weather-app.qml	2015-03-03 18:46:47 +0000
+++ app/ubuntu-weather-app.qml	2015-03-07 16:44:57 +0000
@@ -153,9 +153,7 @@
                 if(location.dbId === undefined || location.dbId=== 0) {
                     storage.insertLocation({location: location});
                 }
-
-                refreshData(true, false)  // load new location into models (without data)
-                refreshData(false, true)  // FIXME: can be really slow as it refreshes all models
+                refreshData();
             }
 
             return !exists;

=== modified file 'app/ui/settings/RefreshIntervalPage.qml'
--- app/ui/settings/RefreshIntervalPage.qml	2015-02-10 14:17:08 +0000
+++ app/ui/settings/RefreshIntervalPage.qml	2015-03-07 16:44:57 +0000
@@ -42,7 +42,7 @@
                     text: Math.floor(modelData / 60).toString() + " " + i18n.tr("minutes")
                 }
                 expanded: true
-                model: [300, 600, 900, 1800]
+                model: [600, 900, 1800, 3600]
                 selectedIndex: model.indexOf(settings.refreshInterval)
                 text: i18n.tr("Interval")
 


Follow ups