Skip to content

Commit

Permalink
Merge pull request #410 from ArnaudOggy/fix_kv1_orphan_routes
Browse files Browse the repository at this point in the history
[Fix] [kv12ntfs] Skip routes (and lines) if no vj above (instead of fail process)
  • Loading branch information
mergify[bot] authored Oct 14, 2019
2 parents ceee671 + c3d37e4 commit 81e7ecd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/kv1/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ fn make_routes(collections: &mut Collections, jopas: &[Jopa]) -> Result<()> {
.collect();
for ((line_id, direction), jopa) in jopas_map {
let id = jopa.route_id();
let (origin, destination) = get_route_origin_destination(collections, &id)?;
let (origin, destination) = skip_fail!(get_route_origin_destination(collections, &id));
let name = format!("{} - {}", origin.name, destination.name);
let destination_stop_area = collections
.stop_areas
Expand Down Expand Up @@ -763,9 +763,9 @@ fn make_lines(collections: &mut Collections, lines: &CollectionWithId<Kv1Line>)
.filter(|r| r.line_id == l.id)
.collect();
let backward_route = route_name_by_direction(&corresponding_routes, "backward");
let forward_route = route_name_by_direction(&corresponding_routes, "forward")
let forward_route = skip_fail!(route_name_by_direction(&corresponding_routes, "forward")
.or(backward_route)
.ok_or_else(|| format_err!("no routes found with line_id={}", l.id,))?;
.ok_or_else(|| format_err!("no routes found with line_id={}", l.id,)));

collections
.lines
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/kv12ntfs/input/JOPAXXXXXX.TMI
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ JOPA|1|I|SYNTUS|2029|90016|SRVC|2|
JOPA|1|I|SYNTUS|2029|90049|SRVC|1|
JOPA|1|I|SYNTUS|2030|00011|SRVC|1|
JOPA|1|I|SYNTUS|3170|0001|SRVC|1|
JOPA|1|I|SYNTUS|6736|6001|SRVC|2|
1 change: 1 addition & 0 deletions tests/fixtures/kv12ntfs/input/LINEXXXXXX.TMI
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
LINE|1|I|SYNTUS|2029|29|29|0|MO Lijn_2029|BUS||
LINE|1|I|SYNTUS|2030|30|30|0|MO Lijn_2030|BUS||
LINE|1|I|SYNTUS|3170|170|170|0|VE Lijn_3170|METRO||
LINE|1|I|SYNTUS|6736|M36|M36|0|AL Lijn_6736|BUS||

0 comments on commit 81e7ecd

Please sign in to comment.