summaryrefslogtreecommitdiff
path: root/lib/Travelynx
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-09-25 16:54:06 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-09-25 16:54:06 +0200
commitf3ad5a5ef3d420bf6f191b736a288aaf60f71d5a (patch)
tree1395380ded92ac55e4e3ec9d0972c900c55b7d54 /lib/Travelynx
parent4a96cf1f476cb55460510c3b87b3df6b6bfce1bf (diff)
connecting trains: HAFAS: Handle delay and pass it to frontend
Diffstat (limited to 'lib/Travelynx')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index a4fe72b..9534912 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -326,6 +326,16 @@ sub get_connecting_trains_p {
my $arrival
= $strp->parse_datetime(
$stop->{arrival} );
+ my $delay = undef;
+ if ( defined $hafas_train->{delay} ) {
+ $delay = $hafas_train->{delay} / 60;
+ if ( $delay
+ and $stop->{arrival} eq
+ $stop->{plannedArrival} )
+ {
+ $arrival->add( minutes => $delay );
+ }
+ }
if ( $departure->epoch >= $exclude_before )
{
$via_count{$dest}++;
@@ -337,6 +347,7 @@ sub get_connecting_trains_p {
$hafas_train->{line}
{name},
departure => $departure,
+ departure_delay => $delay
},
$dest, $arrival
]