[gnome-maps/wip/mlundblad/resrobot-fix-timings] resrobot: Adjust timings of itineraries




commit 43b17e65cf0764dac0ecfa6127af89a301193200
Author: Marcus Lundblad <ml update uu se>
Date:   Tue Feb 22 22:58:05 2022 +0100

    resrobot: Adjust timings of itineraries
    
    As short walk legs in the beginning and end
    of itineraries are pruned off, account for
    this to ensure the overall start and end
    time correspond to the start and end time
    of the first and last leg respectively.

 src/transitplugins/resrobot.js | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/src/transitplugins/resrobot.js b/src/transitplugins/resrobot.js
index aada8d5f..3cdd095f 100644
--- a/src/transitplugins/resrobot.js
+++ b/src/transitplugins/resrobot.js
@@ -318,17 +318,11 @@ var Resrobot = class Resrobot {
 
     _createItinerary(trip) {
         let legs = this._createLegs(trip.LegList.Leg);
-        let duration = this._parseDuration(trip.duration);
-        let origin = trip.LegList.Leg[0].Origin;
-        let destination = trip.LegList.Leg.last().Destination;
-        let [startTime,] = this._parseTime(origin.time, origin.date);
-        let [endTime,] = this._parseTime(destination.time, destination.date);
-
-        return new TransitPlan.Itinerary({ duration:  duration,
-                                           departure: startTime,
-                                           arrival:   endTime,
-                                           legs:      legs,
-                                           duration:  duration });
+        let itinerary = new TransitPlan.Itinerary({ legs: legs });
+
+        itinerary.adjustTimings();
+
+        return itinerary;
     }
 
     /**


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