diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-10-29 21:18:46 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-10-29 21:18:46 +0100 |
commit | 663b4dc6d89d21caa6b670d69780754b40910d90 (patch) | |
tree | 17571683194e5c26a036c69e0f2130280ec31457 /lib/Travelynx.pm | |
parent | f13b4755c7db9df079c6fdb0d22679358a9585b9 (diff) |
live update of next station via javascript
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-x | lib/Travelynx.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index b29d63b..84310d9 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -2406,6 +2406,36 @@ sub startup { ); $self->helper( + 'journey_to_ajax_route' => sub { + my ( $self, $journey ) = @_; + + my @route; + + for my $station ( @{ $journey->{route_after} } ) { + my $station_desc = $station->[0]; + if ( $station->[1]{rt_arr} ) { + $station_desc .= $station->[1]{sched_arr}->strftime(';%s'); + $station_desc .= $station->[1]{rt_arr}->strftime(';%s'); + if ( $station->[1]{rt_dep} ) { + $station_desc + .= $station->[1]{sched_dep}->strftime(';%s'); + $station_desc .= $station->[1]{rt_dep}->strftime(';%s'); + } + else { + $station_desc .= ';0;0'; + } + } + else { + $station_desc .= ';0;0;0;0'; + } + push( @route, $station_desc ); + } + + return join( '|', @route ); + } + ); + + $self->helper( 'get_user_status' => sub { my ( $self, $uid ) = @_; |