diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-02 17:37:43 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-02 17:37:43 +0100 |
commit | 9294008834c0249436124cc3204a9669d46e84d6 (patch) | |
tree | bbf993065652561c283f52a47ebe82520246eef7 /lib/DBInfoscreen | |
parent | 9f42e90cefe4714fd5bc3203892f5e586862a52c (diff) |
apply platform and via filters when using the EFA backend4.31.1
Closes #20
Diffstat (limited to 'lib/DBInfoscreen')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 8c8365f..7d4a25d 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -241,11 +241,17 @@ sub result_has_train_type { sub result_has_via { my ( $result, $via ) = @_; - my @route - = $result->can('route_post') - ? ( $result->route_post, $result->sched_route_post ) - : map { $_->loc->name } $result->route; + my @route; + if ( $result->isa('Travel::Status::DE::IRIS::Result') ) { + @route = ( $result->route_post, $result->sched_route_post ); + } + elsif ( $result->isa('Travel::Status::DE::HAFAS::Journey') ) { + @route = map { $_->loc->name } $result->route; + } + elsif ( $result->isa('Travel::Status::DE::EFA::Departure') ) { + @route = map { $_->full_name } $result->route_post; + } my $eq_result = List::MoreUtils::any { lc eq lc($via) } @route; if ($eq_result) { @@ -1692,7 +1698,9 @@ sub handle_efa { delete $self->stash->{layout}; } - for my $result ( $efa->results ) { + my @results = $self->filter_results( $efa->results ); + + for my $result (@results) { my $time; if ( $template eq 'json' ) { |