[gnome-maps/gnome-40] transitRouter: Use country code from place



commit ba6d12de9e67a1b966a43912b1fb1492603abd4f
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Apr 26 23:34:23 2021 +0200

    transitRouter: Use country code from place
    
    Use the country code from places in the query
    when avaible, before falling back to using
    libgweather to guess country/region based on
    coordinates.

 src/transitRouter.js | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/transitRouter.js b/src/transitRouter.js
index e2a3e5ec..abfb9dec 100644
--- a/src/transitRouter.js
+++ b/src/transitRouter.js
@@ -126,8 +126,10 @@ var TransitRouter = class TransitRoute {
             return null;
     }
 
-    _getMatchingProvidersForLocation(location) {
-        let country = Utils.getCountryCodeForCoordinates(location.latitude,
+    _getMatchingProvidersForPlace(place) {
+        let location = place.location;
+        let country = place.country_code ??
+                      Utils.getCountryCodeForCoordinates(location.latitude,
                                                          location.longitude);
 
         let matchingProviders = [];
@@ -191,14 +193,13 @@ var TransitRouter = class TransitRoute {
      *         or null if no matching provider was found.
      */
     _getBestProviderForQuery() {
-        let startLocation = this._query.filledPoints[0].place.location;
-        let endLocation =
-            this._query.filledPoints.last().place.location;
+        let startPlace = this._query.filledPoints[0].place;
+        let endPlace = this._query.filledPoints.last().place;
 
         let matchingProvidersForStart =
-            this._getMatchingProvidersForLocation(startLocation);
+            this._getMatchingProvidersForPlace(startPlace);
         let matchingProvidersForEnd =
-            this._getMatchingProvidersForLocation(endLocation);
+            this._getMatchingProvidersForPlace(endPlace);
 
         let matchingProviders = [];
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]