diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-01-08 21:20:22 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-01-08 21:20:33 +0100 |
commit | cdff0a8efeba471abe297b431160af27e3573905 (patch) | |
tree | ff1885aae61469c0e4a6dae3437d600b25ad58ee | |
parent | 55795b6d09a6b64507fd1c59bbaebb2cba9ce1b9 (diff) |
bin/hafas: handle partial cancellations
-rwxr-xr-x | bin/hafas | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -297,12 +297,16 @@ for my $res ( $hafas->connections ) { } my $negative_transfer; + my $part_cancelled; my $glance = q{}; for my $sec ( $res->sections ) { if ( $sec->type ne 'JNY' ) { next; } + if ( $sec->dep_cancelled or $sec->arr_cancelled ) { + $part_cancelled = 1; + } if ( defined $sec->transfer_duration ) { if ( $sec->transfer_duration->in_units('minutes') >= 0 ) { $glance .= sprintf( @@ -321,12 +325,14 @@ for my $res ( $hafas->connections ) { } } - if ( $cancelled or $negative_transfer ) { + if ( $cancelled or $negative_transfer or $part_cancelled ) { printf( - "--:-- (%02d:%02d) %s %s %s\n", + "%s (%02d:%02d) %s %s %s\n", + $res->dep->strftime('XX.XX. %H:%M'), $res->duration->in_units( 'hours', 'minutes' ), - $res->arr->strftime(' %H:%M'), - display_occupancies( $res->load ), $glance + $res->arr->strftime('%H:%M'), + display_occupancies( $res->load ), + $glance ); } else { |