From 454d09591294dfdaa75a5364780abe525bbe77b3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 20 Dec 2020 13:56:39 +0100 Subject: fix bogus data when an IC2 is carried by an 146.5 locomotive --- bin/db-wagenreihung-to-json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/db-wagenreihung-to-json b/bin/db-wagenreihung-to-json index 55f980c..3427066 100755 --- a/bin/db-wagenreihung-to-json +++ b/bin/db-wagenreihung-to-json @@ -368,7 +368,7 @@ for my $line (@lines) { if ( $number and $line - =~ m{ ^ \d* \s{1,10} (? ( D? (WL)? (A|AB|B|W) R? D? [acdehimpvw] \S* ) | 40[1-9]([.][0-9])? ) \s* (? \d+ )? (?: $ | \s{3} (? .* ) $ ) }x + =~ m{ ^ \d* \s{1,10} (? ( D? (WL)? (A|AB|B|W) R? D? [acdehimpvw] \S* ) | 40[1-9]([.][0-9])? | 146([.][0-9])? ) \s* (? \d+ )? (?: $ | \s{3} (? .* ) $ ) }x ) { $state = "wagonorder"; @@ -509,7 +509,7 @@ for my $train_number ( keys %map ) { my %type_by_wagon_number; for my $wagon ( @{ $wagon_map{$train_number} // [] } ) { my ( $wagon_type, $wagon_number ) = @{$wagon}; - if ( $wagon_type =~ m{40[1-9]} ) { + if ( $wagon_type =~ m{ 40[1-9] | 146 }x ) { next; } if ( not $wagon_number ) { @@ -523,7 +523,7 @@ for my $train_number ( keys %map ) { if ($wagon_numbers_ok) { for my $wagon ( @{ $wagon_map{$train_number} // [] } ) { my ( $wagon_type, $wagon_number ) = @{$wagon}; - if ( $wagon_type =~ m{40[1-9]} ) { + if ( $wagon_type =~ m{ 40[1-9] | 146 }x ) { next; } @@ -548,6 +548,9 @@ for my $train_number ( keys %map ) { } } +# broken umlauf (indentation changes on page break) +delete $map{77689}{cycle}; + # use canonical output (i.e., sort hash keys) to allow for easy diffing. say JSON->new->utf8->canonical->encode( { -- cgit v1.2.3