Merge lp:~vthompson/ubuntu-weather-app/reboot-allow-adding-duplicate-current-location into lp:ubuntu-weather-app

Proposed by Victor Thompson
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 58
Merged at revision: 67
Proposed branch: lp:~vthompson/ubuntu-weather-app/reboot-allow-adding-duplicate-current-location
Merge into: lp:ubuntu-weather-app
Diff against target: 21 lines (+3/-2)
1 file modified
app/ubuntu-weather-app.qml (+3/-2)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/reboot-allow-adding-duplicate-current-location
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Nekhelesh Ramananthan (community) Needs Information
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+263209@code.launchpad.net

This proposal supersedes a proposal from 2015-06-28.

Commit message

Allow adding the current location as a duplicate to the Locations List.

Description of the change

Allow adding the current location as a duplicate to the Locations List.

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
Nekhelesh Ramananthan (nik90) wrote :

Why do we want to allow the current location as a duplicate to the locations list?

review: Needs Information
Revision history for this message
Victor Thompson (vthompson) wrote :

Let's say you travel a lot and have Chicago and NYC on your list of locations. You live in Amsterdam. Work has you traveling to Paris for an event. Upon arrival you decide to also add Paris to your list of locations--however, currently you can not do so because it matches your current location. For this reason, current location shouldn't prevent a duplicate entry, since it is simply a pointer to your current location.

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

LGTM :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/ubuntu-weather-app.qml'
--- app/ubuntu-weather-app.qml 2015-06-28 19:04:43 +0000
+++ app/ubuntu-weather-app.qml 2015-06-28 23:49:34 +0000
@@ -211,14 +211,15 @@
211 return !exists;211 return !exists;
212 }212 }
213213
214 // Return true if the location given is already in the locationsList214 // Return true if the location given is already in the locationsList, and is not the same
215 // as the current location.
215 function checkLocationExists(location) {216 function checkLocationExists(location) {
216 var exists = false;217 var exists = false;
217218
218 for (var i=0; !exists && i < locationsList.length; i++) {219 for (var i=0; !exists && i < locationsList.length; i++) {
219 var loc = locationsList[i].location;220 var loc = locationsList[i].location;
220221
221 if (loc.services.geonames && (loc.services.geonames === location.services.geonames)) {222 if (loc.services.geonames && (loc.services.geonames === location.services.geonames) && !(settings.addedCurrentLocation && i === 0)) {
222 exists = true;223 exists = true;
223 }224 }
224 }225 }

Subscribers

People subscribed via source and target branches

to all changes: