← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/reboot-allow-adding-duplicate-current-location into lp:ubuntu-weather-app/reboot.

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

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

For more details, see:
https://code.launchpad.net/~vthompson/ubuntu-weather-app/reboot-allow-adding-duplicate-current-location/+merge/263209

Allow adding the current location as a duplicate to the Locations List.
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/reboot-allow-adding-duplicate-current-location into lp:ubuntu-weather-app/reboot.
=== 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 @@
             return !exists;
         }
 
-        // Return true if the location given is already in the locationsList
+        // Return true if the location given is already in the locationsList, and is not the same
+        // as the current location.
         function checkLocationExists(location) {
             var exists = false;
 
             for (var i=0; !exists && i < locationsList.length; i++) {
                 var loc = locationsList[i].location;
 
-                if (loc.services.geonames && (loc.services.geonames === location.services.geonames)) {
+                if (loc.services.geonames && (loc.services.geonames === location.services.geonames) && !(settings.addedCurrentLocation && i === 0)) {
                     exists = true;
                 }
             }


Follow ups