[gnome-maps/wip/mlundblad/transit-plugin-resrobot: 3/4] openTripPlanner: Use new method in TransitPlan to update



commit 76031433bb39403297e91ba45ea36550212f0c32
Author: Marcus Lundblad <ml update uu se>
Date:   Sun Oct 6 09:39:11 2019 +0200

    openTripPlanner: Use new method in TransitPlan to update
    
    Use new convinience method in Plan to add new/added
    itineraries.

 src/transitplugins/openTripPlanner.js | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
---
diff --git a/src/transitplugins/openTripPlanner.js b/src/transitplugins/openTripPlanner.js
index d11b67f..61192da 100644
--- a/src/transitplugins/openTripPlanner.js
+++ b/src/transitplugins/openTripPlanner.js
@@ -654,22 +654,9 @@ var OpenTripPlanner = class OpenTripPlanner {
      * a request to load more
      */
     _updateWithNewItineraries(itineraries) {
-        /* sort itineraries, by departure time ascending if querying
-         * by leaving time, by arrival time descending when querying
-         * by arriving time
-         */
-        if (this._query.arriveBy)
-            itineraries.sort(TransitPlan.sortItinerariesByArrivalDesc);
-        else
-            itineraries.sort(TransitPlan.sortItinerariesByDepartureAsc);
-
-        let newItineraries =
-            this._extendPrevious ? this.plan.itineraries.concat(itineraries) :
-                                   itineraries;
-
-        // reset the "load more results" flag
+        this.plan.updateWithNewItineraries(itineraries, this._query.arriveBy,
+                                           this._extendPrevious);
         this._extendPrevious = false;
-        this.plan.update(newItineraries);
     }
 
     _recalculateItinerariesRecursive(itineraries, index) {


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