Merge lp:~martin-borho/ubuntu-weather-app/reboot-fix-missing-icon-conditons-twc into lp:ubuntu-weather-app

Proposed by Martin Borho
Status: Merged
Approved by: Victor Thompson
Approved revision: 26
Merged at revision: 26
Proposed branch: lp:~martin-borho/ubuntu-weather-app/reboot-fix-missing-icon-conditons-twc
Merge into: lp:ubuntu-weather-app
Diff against target: 50 lines (+20/-11)
1 file modified
app/data/WeatherApi.js (+20/-11)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/reboot-fix-missing-icon-conditons-twc
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+253763@code.launchpad.net

Commit message

Fix for missing condtion and icon at TWC.

Description of the change

Fix for missing condtion and icon at TWC. Using the first icon or condition from the hourly forecast.

Fills also the missing icons mentioned in https://code.launchpad.net/~martin-borho/ubuntu-weather-app/reboot-flatten-locationpage/+merge/253762

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

LGTM! These two MPs (this and lp:~martin-borho/ubuntu-weather-app/reboot-flatten-locationpage) look good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/data/WeatherApi.js'
2--- app/data/WeatherApi.js 2015-03-16 13:42:08 +0000
3+++ app/data/WeatherApi.js 2015-03-21 17:44:02 +0000
4@@ -23,7 +23,7 @@
5 * Version of the response data format.
6 * Increase this number to force a refresh.
7 */
8-var RESPONSE_DATA_VERSION = 20150307;
9+var RESPONSE_DATA_VERSION = 20150321;
10
11 /**
12 * Helper functions
13@@ -533,18 +533,27 @@
14 tmpResult[day] = _buildDayFormat(date, dayData, nowMs);
15 }
16 //
17+ if(data["forecast"] !== undefined) {
18+ data["forecast"].forEach(function(hourData) {
19+ var dateData = getLocationTime((hourData.dateTime*1000)+offset),
20+ day = dateData.year+"-"+dateData.month+"-"+dateData.date;
21+ if(tmpResult[day]) {
22+ tmpResult[day]["hourly"].push(_buildDataPoint(dateData, hourData));
23+ }
24+ })
25+ }
26+ //
27 if(data["current"]) {
28- var today = todayDate.year+"-"+todayDate.month+"-"+todayDate.date
29+ var today = todayDate.year+"-"+todayDate.month+"-"+todayDate.date;
30 tmpResult[today]["current"] = _buildDataPoint(todayDate, data["current"]);
31- }
32- if(data["forecast"] !== undefined) {
33- data["forecast"].forEach(function(hourData) {
34- var dateData = getLocationTime((hourData.dateTime*1000)+offset),
35- day = dateData.year+"-"+dateData.month+"-"+dateData.date;
36- if(tmpResult[day]) {
37- tmpResult[day]["hourly"].push(_buildDataPoint(dateData, hourData));
38- }
39- })
40+ // if the icon is missing, use the first from the hourly forecast
41+ if(!tmpResult[today]["current"].icon && tmpResult[today]["hourly"] && tmpResult[today]["hourly"].length > 0) {
42+ tmpResult[today]["current"].icon = tmpResult[today]["hourly"][0].icon;
43+ }
44+ // if condtion text is missing, use the conditon from the first hourly forecast
45+ if(tmpResult[today]["current"].condition === "-" && tmpResult[today]["hourly"] && tmpResult[today]["hourly"].length > 0) {
46+ tmpResult[today]["current"].condition = tmpResult[today]["hourly"][0].condition;
47+ }
48 }
49 //
50 for(var d in tmpResult) {

Subscribers

People subscribed via source and target branches

to all changes: