summaryrefslogtreecommitdiff
path: root/bin/hafas
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-01-08 21:20:22 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-01-08 21:20:33 +0100
commitcdff0a8efeba471abe297b431160af27e3573905 (patch)
treeff1885aae61469c0e4a6dae3437d600b25ad58ee /bin/hafas
parent55795b6d09a6b64507fd1c59bbaebb2cba9ce1b9 (diff)
bin/hafas: handle partial cancellations
Diffstat (limited to 'bin/hafas')
-rwxr-xr-xbin/hafas14
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/hafas b/bin/hafas
index 3a50bf7..d5f0612 100755
--- a/bin/hafas
+++ b/bin/hafas
@@ -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 {