diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-07-26 15:36:22 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-07-26 15:36:22 +0200 |
commit | 1594ba93277825a02d1b989df2db34ae98a54429 (patch) | |
tree | b62dfdb6901cc9f4fbe1229be86e069ccc2484ee /lib/Travelynx | |
parent | 960de27f0eca0fcb2549c8271a384230c4a6b06f (diff) |
_checked_out: move get_connecting_trains call to controller
Diffstat (limited to 'lib/Travelynx')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 991526e..eb8a657 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -362,7 +362,16 @@ sub status_card { ); } else { - $self->render( '_checked_out', journey => $status ); + my @connecting_trains; + my $now = DateTime->now( time_zone => 'Europe/Berlin' ); + if ( $now->epoch - $status->{timestamp}->epoch < ( 30 * 60 ) ) { + @connecting_trains = $self->get_connecting_trains; + } + $self->render( + '_checked_out', + journey => $status, + connections => \@connecting_trains + ); } } |