diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-12-27 18:42:42 +0100 |
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-12-27 18:42:42 +0100 |
| commit | e9e06417cff8f42beb4debc9a90cb439f53e0bce (patch) | |
| tree | 6e38b4689bd8d63eac31e518804666e5374b695e /lib/Travelynx/Controller | |
| parent | 3acb1b379b9be3c1cc252d7a55f1ec34240e48f6 (diff) | |
DBRIS: show connections while still checked in
Diffstat (limited to 'lib/Travelynx/Controller')
| -rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 43 |
1 files changed, 14 insertions, 29 deletions
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 = (?<name> [^@]+ ) [@] }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 = (?<name> [^@]+ ) [@] }x ) { + $status->{station_name} = $+{name}; + } } elsif ($hafas_service) { |
