From 8c4df88032fbea46e2d95f5ac716d26fbf982c54 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 8 Mar 2019 21:23:36 +0100 Subject: allow filtering by train for external travelynx links --- index.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'index.pl') diff --git a/index.pl b/index.pl index d0bba0e..78719f5 100755 --- a/index.pl +++ b/index.pl @@ -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}, -- cgit v1.2.3