allow filtering by train for external travelynx links
This commit is contained in:
parent
98fc5a3aba
commit
8c4df88032
1 changed files with 7 additions and 1 deletions
8
index.pl
8
index.pl
|
@ -1234,8 +1234,9 @@ post '/logout' => sub {
|
||||||
};
|
};
|
||||||
|
|
||||||
get '/s/*station' => sub {
|
get '/s/*station' => sub {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
my $station = $self->stash('station');
|
my $station = $self->stash('station');
|
||||||
|
my $train = $self->param('train');
|
||||||
|
|
||||||
my $status = get_departures($station);
|
my $status = get_departures($station);
|
||||||
|
|
||||||
|
@ -1251,6 +1252,11 @@ get '/s/*station' => sub {
|
||||||
map { [ $_, $_->departure->epoch // $_->sched_departure->epoch ] }
|
map { [ $_, $_->departure->epoch // $_->sched_departure->epoch ] }
|
||||||
@results;
|
@results;
|
||||||
|
|
||||||
|
if ($train) {
|
||||||
|
@results
|
||||||
|
= grep { $_->type . ' ' . $_->train_no eq $train } @results;
|
||||||
|
}
|
||||||
|
|
||||||
$self->render(
|
$self->render(
|
||||||
'departures',
|
'departures',
|
||||||
ds100 => $status->{station_ds100},
|
ds100 => $status->{station_ds100},
|
||||||
|
|
Loading…
Reference in a new issue