Add support for non-round-trips with a single fixed endpoint (#6050)
Currently /trip supports finding round-trip routes where only the start or end location is fixed. This PR extends this feature to non-round-trip requests. We do this by a new table manipulation that simulates non-round-trip fixed endpoint requests as a round-trip request.
This commit is contained in:
@@ -61,7 +61,8 @@ module.exports = function () {
|
||||
var subTrips;
|
||||
var trip_durations;
|
||||
var trip_distance;
|
||||
if (res.statusCode === 200) {
|
||||
var ok = res.statusCode === 200;
|
||||
if (ok) {
|
||||
if (headers.has('trips')) {
|
||||
subTrips = json.trips.filter(t => !!t).map(t => t.legs).map(tl => Array.prototype.concat.apply([], tl.map((sl, i) => {
|
||||
var toAdd = [];
|
||||
@@ -84,8 +85,7 @@ module.exports = function () {
|
||||
}
|
||||
}
|
||||
|
||||
var ok = true,
|
||||
encodedResult = '';
|
||||
var encodedResult = '';
|
||||
|
||||
if (json.trips) row.trips.split(',').forEach((sub, si) => {
|
||||
if (si >= subTrips.length) {
|
||||
|
||||
Reference in New Issue
Block a user