diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-03-08 21:23:36 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-03-08 21:23:36 +0100 |
commit | 8c4df88032fbea46e2d95f5ac716d26fbf982c54 (patch) | |
tree | d4abafea809c1c8801ccee3348558a597529d0f7 | |
parent | 98fc5a3aba2ad4e95607405f424a2e1e5e12cb4e (diff) |
allow filtering by train for external travelynx links
-rwxr-xr-x | index.pl | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1234,8 +1234,9 @@ post '/logout' => sub { }; get '/s/*station' => sub { - my ($self) = @_; + my ($self) = @_; my $station = $self->stash('station'); + my $train = $self->param('train'); my $status = get_departures($station); @@ -1251,6 +1252,11 @@ get '/s/*station' => sub { map { [ $_, $_->departure->epoch // $_->sched_departure->epoch ] } @results; + if ($train) { + @results + = grep { $_->type . ' ' . $_->train_no eq $train } @results; + } + $self->render( 'departures', ds100 => $status->{station_ds100}, |