summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-12-27 15:12:17 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-12-27 15:12:17 +0100
commit3acb1b379b9be3c1cc252d7a55f1ec34240e48f6 (patch)
tree14c6af48601b7de74036b92979616ff98e70c58c /lib/Travelynx/Controller
parentb3300e3a92d0ac3a4b029b5f9c48a08c87a58ba1 (diff)
EFA suggestions: go back to a single template
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm36
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 4b0c341..e48dd2b 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -943,34 +943,28 @@ sub station {
@results = map { $_->[0] }
sort { $b->[1] <=> $a->[1] }
map { [ $_, $_->datetime->epoch ] } $status->results;
- $status = {
- station_eva => $status->stop->id_num,
- station_name => $status->stop->full_name,
- related_stations => [],
- };
my $backend_id
= $self->stations->get_backend_id( efa => $efa_service );
my @destinations = $self->journeys->get_connection_targets(
uid => $uid,
backend_id => $backend_id,
- eva => $status->{station_eva},
+ eva => $status->stop->id_num,
);
- for my $dep (@results) {
- destination: for my $dest (@destinations) {
- for my $stop ( $dep->route_post ) {
- if ( $stop->full_name eq $dest->{name} ) {
- push( @suggestions,
- [ $dep, $dest, $stop->arr ] );
- next destination;
- }
- }
- }
- }
+ @suggestions = $self->efa->grep_suggestions(
+ status => $status,
+ destinations => \@destinations
+ );
+ @suggestions = sort { $a->[0]{sort_ts} <=> $b->[0]{sort_ts} }
+ grep {
+ $_->[0]{sort_ts} >= $now - 300
+ and $_->[0]{sort_ts} <= $now + 1800
+ } @suggestions;
- @suggestions = map { $_->[0] }
- sort { $a->[1] <=> $b->[1] }
- grep { $_->[1] >= $now - 300 and $_->[1] <= $now + 1800 }
- map { [ $_, $_->[0]->datetime->epoch ] } @suggestions;
+ $status = {
+ station_eva => $status->stop->id_num,
+ station_name => $status->stop->full_name,
+ related_stations => [],
+ };
}
elsif ($motis_service) {
@results = map { $_->[0] }