diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-06 13:21:58 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-06 13:21:58 +0200 |
commit | 64c3769d3d8c746af09260c21bcd4ce29612aaab (patch) | |
tree | 11f320222c1cb6dee1b0ab91ddef98b3ad04fb2b | |
parent | 2114f50999b979c0cd96ea04a64181b9c6f6665d (diff) |
-Of etc: show delays
-rwxr-xr-x | bin/efa-m | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -297,17 +297,29 @@ sub display_result { sub show_stopseq { my $trip = $efa->result; - printf( "%s %s → %s\n", - $trip->line, $trip->number // q{}, - $trip->dest_name ); + printf( "%s %s → %s\n", $trip->type, $trip->line // q{}, $trip->dest_name ); + + printf( + "Fahrt %s am %s\n", + $trip->number || $stopseq, + ( $trip->route )[0]->sched_dep->strftime('%d.%m.%Y'), + ); + say q{}; + + my $delay_len = 0; + my $max_delay = max map { abs( $_->delay // 0 ) } $trip->route; + if ($max_delay) { + $delay_len = length( sprintf( '%+d', $max_delay ) ) + 1; + } for my $stop ( $trip->route ) { printf( - "%s → %s %s (%s) %s\n", + "%s → %s%${delay_len}s %s (%s) %s\n", $stop->arr ? $stop->arr->strftime('%H:%M') : q{ }, $stop->dep ? $stop->dep->strftime('%H:%M') : q{ }, + $stop->delay ? sprintf( ' %+d', $stop->delay ) : q{}, $stop->full_name, $stop->niveau, $stop->platform |