From e9e06417cff8f42beb4debc9a90cb439f53e0bce Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 27 Dec 2025 18:42:42 +0100 Subject: DBRIS: show connections while still checked in --- lib/Travelynx/Controller/Traveling.pm | 43 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 29 deletions(-) (limited to 'lib/Travelynx/Controller') diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index e48dd2b..f328ba8 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -878,15 +878,6 @@ sub station { sort { $b->[1] <=> $a->[1] } map { [ $_, $_->dep->epoch ] } $status->results; - $status = { - station_eva => $station, - related_stations => [], - }; - - if ( $station =~ m{ [@] O = (? [^@]+ ) [@] }x ) { - $status->{station_name} = $+{name}; - } - my ($eva) = ( $station =~ m{ [@] L = (\d+) }x ); my $backend_id = $self->stations->get_backend_id( dbris => $dbris_service ); @@ -895,28 +886,22 @@ sub station { backend_id => $backend_id, eva => $eva ); + @suggestions = $self->dbris->grep_suggestions( + status => $status, + destinations => \@destinations + ); - for my $dep (@results) { - destination: for my $dest (@destinations) { - if ( $dep->destination - and $dep->destination eq $dest->{name} ) - { - push( @suggestions, [ $dep, $dest ] ); - next destination; - } - for my $via_name ( $dep->via ) { - if ( $via_name eq $dest->{name} ) { - push( @suggestions, [ $dep, $dest ] ); - next destination; - } - } - } - } + @suggestions = sort { $a->[0]{sort_ts} <=> $b->[0]{sort_ts} } + grep { $_->[0]{sort_ts} >= $now - 300 } @suggestions; - @suggestions = map { $_->[0] } - sort { $a->[1] <=> $b->[1] } - grep { $_->[1] >= $now - 300 } - map { [ $_, $_->[0]->dep->epoch ] } @suggestions; + $status = { + station_eva => $station, + related_stations => [], + }; + + if ( $station =~ m{ [@] O = (? [^@]+ ) [@] }x ) { + $status->{station_name} = $+{name}; + } } elsif ($hafas_service) { -- cgit v1.2.3