Fix connection display for Travel::Status::DE::HAFAS 5.x

This commit is contained in:
Birte Kristina Friesel 2023-12-27 11:16:38 +01:00
parent 65f3548842
commit 4d044fb98a
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA

View file

@ -307,14 +307,14 @@ sub get_connecting_trains_p {
$iris_train->[3] = $hafas_train->load; $iris_train->[3] = $hafas_train->load;
} }
for my $stop ( $hafas_train->route ) { for my $stop ( $hafas_train->route ) {
if ( $stop->{name} if ( $stop->loc->name
and $stop->{name} eq and $stop->loc->name eq
$iris_train->[1]->{name} $iris_train->[1]->{name}
and $stop->{arr} ) and $stop->arr )
{ {
$iris_train->[2] = $stop->{arr}; $iris_train->[2] = $stop->arr;
if ( $iris_train->[0]->departure_delay if ( $iris_train->[0]->departure_delay
and not $stop->{arr_delay} ) and not $stop->arr_delay )
{ {
$iris_train->[2] $iris_train->[2]
->add( minutes => $iris_train->[0] ->add( minutes => $iris_train->[0]
@ -338,16 +338,16 @@ sub get_connecting_trains_p {
} }
for my $stop ( $hafas_train->route ) { for my $stop ( $hafas_train->route ) {
for my $dest (@destinations) { for my $dest (@destinations) {
if ( $stop->{name} if ( $stop->loc->name
and $stop->{name} eq $dest->{name} and $stop->loc->name eq $dest->{name}
and $via_count{ $dest->{name} } < 2 and $via_count{ $dest->{name} } < 2
and $hafas_train->datetime ) and $hafas_train->datetime )
{ {
my $departure = $hafas_train->datetime; my $departure = $hafas_train->datetime;
my $arrival = $stop->{arr}; my $arrival = $stop->arr;
my $delay = $hafas_train->delay; my $delay = $hafas_train->delay;
if ( $delay if ( $delay
and $stop->{arr} == $stop->{sched_arr} ) and $stop->arr == $stop->sched_arr )
{ {
$arrival->add( minutes => $delay ); $arrival->add( minutes => $delay );
} }