Skip to content

Commit 68cc920

Browse files
committed
sort routes by duration
1 parent 24fbe56 commit 68cc920

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pymmrouting/routeplanner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .routingresult import RoutingResult, RawMultimodalPath, ModePath
99
from .orm_graphmodel import Session, Mode, SwitchType
1010
from .settings import PGBOUNCER_CONF, LIB_MMSPA_CONF
11+
from operator import itemgetter
1112
import time
1213
import logging
1314

@@ -157,6 +158,7 @@ def refine_results(self, results):
157158
# is found in the result path. Such a path will be eliminated.
158159
continue
159160
refined_results.append(r)
161+
refined_results.sort(key=itemgetter('duration'))
160162
results['routes'] = refined_results
161163
return results
162164

0 commit comments

Comments
 (0)