diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-08-14 12:35:22 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-08-14 12:35:22 +0200 |
commit | 8f377d4ee5e279e14e26e14857081aa0c8f3184b (patch) | |
tree | 9c19ba05f656311b44fb8ced32347e575e8b17fd /lib | |
parent | cc381d199faafb37e73054bc46fbc6adbf5adfc8 (diff) |
traveling: redirect hafas journeys to hafas=1
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 39c8e8f..b64fcfa 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -667,6 +667,9 @@ sub travel_action { my ( $still_checked_in, undef ) = @_; if ( my $destination = $params->{dest} ) { my $station_link = '/s/' . $destination; + if ( $status->{train_id} =~ m{[|]} ) { + $station_link .= '?hafas=1'; + } $self->render( json => { success => 1, @@ -692,6 +695,7 @@ sub travel_action { } elsif ( $params->{action} eq 'checkout' ) { $self->render_later; + my $status = $self->get_user_status; $self->checkout_p( station => $params->{station}, force => $params->{force} @@ -699,6 +703,9 @@ sub travel_action { sub { my ( $still_checked_in, $error ) = @_; my $station_link = '/s/' . $params->{station}; + if ( $status->{train_id} =~ m{[|]} ) { + $station_link .= '?hafas=1'; + } if ($error) { $self->render( @@ -747,11 +754,11 @@ sub travel_action { else { my $redir = '/'; if ( $status->{checked_in} or $status->{cancelled} ) { - if ( $status->{dep_ds100} ) { - $redir = '/s/' . $status->{dep_ds100}; + if ( $status->{train_id} =~ m{[|]} ) { + $redir = '/s/' . $status->{dep_eva} . '?hafas=1'; } else { - $redir = '/s/' . $status->{dep_eva} . '?hafas=1'; + $redir = '/s/' . $status->{dep_ds100}; } } $self->render( |