fix cucumber outputs

This commit is contained in:
karenzshea 2017-01-31 12:04:07 +01:00 committed by Patrick Niklaus
parent 7256b6d0d4
commit 8d7aae8687
3 changed files with 7 additions and 9 deletions

View File

@ -164,12 +164,11 @@ module.exports = function () {
}; };
this.annotationList = (instructions) => { this.annotationList = (instructions) => {
if (!('annotation' in instructions.legs[0]) || instructions.legs[0].annotation.length < 1) if (!('annotation' in instructions.legs[0]))
return ''; return '';
return instructions.legs.map(l => { return instructions.legs.map(l => {
var fields = Object.keys(l.annotation); var fields = Object.keys(l.annotation);
if (fields.length < 1) return '';
var collected = l.annotation[fields[0]].map((f, i) => { var collected = l.annotation[fields[0]].map((f, i) => {
var zipped = []; var zipped = [];
for (var j = 0; j < fields.length; j++) { for (var j = 0; j < fields.length; j++) {

View File

@ -142,7 +142,7 @@ Feature: Basic Map Matching
When I match I should get When I match I should get
| trace | matchings | annotation | | trace | matchings | annotation |
| ach | ach | 1:1,0:1:1:2:1 | | ach | ach | 1,1,0,1,1,2,1 |
Scenario: Testbot - Duration details Scenario: Testbot - Duration details
Given the query options Given the query options
@ -167,9 +167,9 @@ Feature: Basic Map Matching
And the contract extra arguments "--segment-speed-file {speeds_file}" And the contract extra arguments "--segment-speed-file {speeds_file}"
When I match I should get When I match I should get
| trace | matchings | annotation | | trace | matchings | annotation |
| abeh | abeh | 1:1:10.008842:1,0:0:0:0,1:1:10.008842:0,1:1:10.008842:0,1:1:10.008842:0,0:0:0:0,2:2:19.906475:0,1:1:10.008842:0 | | abeh | abeh | 1:10.008842:1:1:1,0:0:0:2:0,1:10.008842:1:2:0,1:10.008842:1:3:0,1:10.008842:1:4:0,0:0:0:4:0,2:19.906475:2:5:0,1:10.008842:1:6:0 |
| abci | abci | 1:1:10.008842:1,0:0:0:0,1:1:10.008842:0,0:0:0:0,1:1:10.010367:0 | | abci | abci | 1:10.008842:1:1:1,0:0:0:2:0,1:10.008842:1:2:0,0:0:0:2:0,1:10.010367:1:3:0 |
# The following is the same as the above, but separated for readability (line length) # The following is the same as the above, but separated for readability (line length)
When I match I should get When I match I should get
@ -388,4 +388,4 @@ Feature: Basic Map Matching
When I match I should get When I match I should get
| trace | annotation | | trace | annotation |
| ac | 2:2,2:2 | | ac | 2:2,2:2 |
| ca | 2:2:0,2:2:0 | | ca | 2:2,2:2,0:0 |

View File

@ -215,8 +215,7 @@ class RouteAPI : public BaseAPI
std::vector<util::json::Object> annotations; std::vector<util::json::Object> annotations;
if (!static_cast<bool>(parameters.annotations_type & if (parameters.annotations_type != RouteParameters::AnnotationsType::None)
RouteParameters::AnnotationsType::None))
{ {
for (const auto idx : util::irange<std::size_t>(0UL, leg_geometries.size())) for (const auto idx : util::irange<std::size_t>(0UL, leg_geometries.size()))
{ {