[gnome-maps/wip/mlundblad/transit-plugin-gometro: 7/9] openTripPlanner: Add tweaks for the GoMetro API



commit 65c4d95395b23f04650f4c469bdb9fccda3035cf
Author: Marcus Lundblad <ml update uu se>
Date:   Wed Feb 5 22:57:09 2020 +0100

    openTripPlanner: Add tweaks for the GoMetro API
    
    The "itineraries" element appears directly in the root
    rather than in a "plan" element.
    Transit legs lack intermediate stops.

 src/transitplugins/openTripPlanner.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/transitplugins/openTripPlanner.js b/src/transitplugins/openTripPlanner.js
index 62edd2ac..eeb5aa56 100644
--- a/src/transitplugins/openTripPlanner.js
+++ b/src/transitplugins/openTripPlanner.js
@@ -591,6 +591,10 @@ var OpenTripPlanner = class OpenTripPlanner {
                     itineraries =
                         itineraries.concat(
                             this._createItineraries(plan.itineraries));
+                } else if (route.itineraries) {
+                    itineraries =
+                        itineraries.concat(
+                            this._createItineraries(route.itineraries));
                 }
 
                 if (itineraries.length === 0) {
@@ -1062,7 +1066,7 @@ var OpenTripPlanner = class OpenTripPlanner {
                                            textColor:            textColor,
                                            tripShortName:        leg.tripShortName });
 
-        if (leg.transitLeg)
+        if (leg.transitLeg && leg.intermediateStops)
             result.intermediateStops = this._createIntermediateStops(leg);
         else if (!this._onlyTransitData)
             result.walkingInstructions = this._createTurnpoints(leg, polyline);


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