From 64c3769d3d8c746af09260c21bcd4ce29612aaab Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 6 Oct 2024 13:21:58 +0200 Subject: -Of etc: show delays --- bin/efa-m | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/bin/efa-m b/bin/efa-m index 35f70c3..2dd4b09 100755 --- a/bin/efa-m +++ b/bin/efa-m @@ -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 -- cgit v1.2.3