diff --git a/features/step_definitions/trip.js b/features/step_definitions/trip.js index 699aa27b851..55d5d2c03c7 100644 --- a/features/step_definitions/trip.js +++ b/features/step_definitions/trip.js @@ -34,7 +34,7 @@ module.exports = function () { json = JSON.parse(res.body); } - console.log(json); + console.log(JSON.stringify(json)); if (headers.has('status')) { got.status = json.status.toString(); @@ -59,7 +59,7 @@ module.exports = function () { got.source = json.trips[0].source; } if (this.queryParams['destination']) { - got.source = json.trips[0].destination; + got.destination = json.trips[0].destination; } } @@ -85,6 +85,12 @@ module.exports = function () { }))); trip_durations = all_durations.map( a => a.reduce(add, 0)); } + if(headers.has('distance')) { + var all_distance = json.trips.filter(t => !!t).map(t => t.legs).map(tl => Array.prototype.concat.apply([], tl.map(sl => { + return sl.distance; + }))); + trip_distance = all_distance.map( a => a.reduce(add, 0)); + } } var ok = true, @@ -99,9 +105,10 @@ module.exports = function () { for (var ni=0; ni -1 && parameters.destination > -1) { for (std::size_t r_counter = 0, f_counter = 0; r_counter < result_table.size(), f_counter < tfse_table_.size();) { - // swap parameters.destination column with to column - if (r_counter % number_of_original_nodes == parameters.destination) { + // swap parameters.destination column with parameters.source column + if (r_counter % number_of_original_nodes == (long) parameters.destination) { tfse_table_[f_counter - 2] = result_table_[r_counter++]; continue; }