Merge lp:~martin-borho/ubuntu-weather-app/twc_5day_forecast into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Martin Borho
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 228
Merged at revision: 230
Proposed branch: lp:~martin-borho/ubuntu-weather-app/twc_5day_forecast
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 28 lines (+6/-5)
1 file modified
components/WeatherApi.js (+6/-5)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/twc_5day_forecast
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+215269@code.launchpad.net

Commit message

Limiting TWC forecast to 5 days according guidelines

Description of the change

Limiting TWC forecast to 5 days according guidelines

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
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Looks great, thanks Martin!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components/WeatherApi.js'
2--- components/WeatherApi.js 2014-03-31 14:53:17 +0000
3+++ components/WeatherApi.js 2014-04-10 18:08:52 +0000
4@@ -518,10 +518,11 @@
5 if(location.services && !location.services[_serviceName] && data["location"].key) {
6 location.services[_serviceName] = data["location"].key
7 }
8- //
9- data["daily"].forEach(function(dayData) {
10- var date = getLocationTime(((dayData.validDate*1000)-1000)+offset), // minus 1 sec to handle +/-12 TZ
11- day = date.year+"-"+date.month+"-"+date.date;
12+ // only 5 days of forecast for TWC
13+ for(var x=0;x<5;x++) {
14+ var dayData = data["daily"][x],
15+ date = getLocationTime(((dayData.validDate*1000)-1000)+offset); // minus 1 sec to handle +/-12 TZ
16+ day = date.year+"-"+date.month+"-"+date.date;
17 if(!todayDate) {
18 if(localNow.year+"-"+localNow.month+"-"+localNow.date > day) {
19 // skip "yesterday"
20@@ -530,7 +531,7 @@
21 todayDate = date;
22 }
23 tmpResult[day] = _buildDayFormat(date, dayData, nowMs);
24- })
25+ }
26 //
27 if(data["current"]) {
28 var today = todayDate.year+"-"+todayDate.month+"-"+todayDate.date

Subscribers

People subscribed via source and target branches