summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-12-04 20:49:15 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-12-04 20:49:15 +0100
commit1ed38fb0ba23389338a4eba439fc9ab521564fda (patch)
treed558b82b649f18ab49dd9073ff5fb50f7af318a7 /lib
parent6eb67559e241aa8fac8556040b03090af36a3e56 (diff)
EFA: show checkin suggestions2.17.27
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 6f8e905..154938d 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -1368,6 +1368,28 @@ sub station {
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},
+ );
+ 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 ] );
+ next destination;
+ }
+ }
+ }
+ }
+
+ @suggestions = map { $_->[0] }
+ sort { $a->[1] <=> $b->[1] }
+ grep { $_->[1] >= $now - 300 and $_->[1] <= $now + 1800 }
+ map { [ $_, $_->[0]->datetime->epoch ] } @suggestions;
}
elsif ($motis_service) {
@results = map { $_->[0] }
@@ -1504,6 +1526,7 @@ sub station {
related_stations => $status->{related_stations},
user_status => $user_status,
can_check_out => $can_check_out,
+ suggestions => \@suggestions,
title => "travelynx: $status->{station_name}",
);
}