summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-07-26 14:51:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-07-26 14:51:57 +0200
commit960de27f0eca0fcb2549c8271a384230c4a6b06f (patch)
tree43514cc0c80092b28439c6e7039b8968cf131a33
parent35338125bcf5c503ec57b857ed2d11c547eca4ab (diff)
move get_connecting_trains out of _cancelled_departure template
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm24
-rw-r--r--templates/_cancelled_departure.html.ep2
2 files changed, 21 insertions, 5 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 937c740..991526e 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -351,8 +351,15 @@ sub status_card {
$self->render( '_checked_in', journey => $status );
}
elsif ( $status->{cancellation} ) {
- $self->render( '_cancelled_departure',
- journey => $status->{cancellation} );
+ my @connecting_trains = $self->get_connecting_trains(
+ eva => $status->{cancellation}{dep_eva},
+ destination_name => $status->{cancellation}{arr_name}
+ );
+ $self->render(
+ '_cancelled_departure',
+ journey => $status->{cancellation},
+ connections => \@connecting_trains
+ );
}
else {
$self->render( '_checked_out', journey => $status );
@@ -628,8 +635,17 @@ sub station {
= grep { $_->type . ' ' . $_->train_no eq $train } @results;
}
else {
- @connecting_trains = $self->get_connecting_trains(
- eva => $status->{station_eva} );
+ my $user = $self->get_user_status;
+ if ( $user->{cancellation} ) {
+ @connecting_trains = $self->get_connecting_trains(
+ eva => $user->{cancellation}{dep_eva},
+ destination_name => $user->{cancellation}{arr_name}
+ );
+ }
+ else {
+ @connecting_trains = $self->get_connecting_trains(
+ eva => $status->{station_eva} );
+ }
}
$self->render(
diff --git a/templates/_cancelled_departure.html.ep b/templates/_cancelled_departure.html.ep
index 220c49d..1d5c76a 100644
--- a/templates/_cancelled_departure.html.ep
+++ b/templates/_cancelled_departure.html.ep
@@ -5,7 +5,7 @@
in <a href="/s/<%= $journey->{dep_ds100} %>"><%= $journey->{dep_name} %></a>
entfällt. Der Zugausfall auf der Fahrt nach <%= $journey->{arr_name} %> wurde bereits dokumentiert.
</p>
- % if (my @connections = get_connecting_trains(eva => $journey->{dep_eva}, destination_name => $journey->{arr_name})) {
+ % if (my @connections = @{stash('connections') // []}) {
<p>Alternative Reisemöglichkeiten:</p>
%= include '_connections', connections => \@connections, checkin_from => $journey->{dep_ds100};
% }