Loading lib/Travelynx/Controller/Traveling.pm +18 −4 Original line number Diff line number Diff line Loading @@ -65,8 +65,10 @@ sub get_connecting_trains_p { return $promise->reject; } my @destinations = uniq_by { $_->{name} } $self->journeys->get_connection_targets(%opt); my ( $dest_ids, $destinations ) = $self->journeys->get_connection_targets(%opt); my @destinations = uniq_by { $_->{name} } @{$destinations}; if ($exclude_via) { @destinations = grep { $_->{name} ne $exclude_via } @destinations; Loading @@ -76,6 +78,12 @@ sub get_connecting_trains_p { return $promise->reject; } my $iris_eva = $eva; if ( $eva < 8000000 ) { $iris_eva = ( List::Util::first { $_ >= 8000000 } @{$dest_ids} ) // $eva; } my $can_check_in = not $arr_epoch || ( $arr_countdown // 1 ) < 0; my $lookahead = $can_check_in ? 40 : ( ( ${arr_countdown} // 0 ) / 60 + 40 ); Loading @@ -83,11 +91,11 @@ sub get_connecting_trains_p { my $iris_promise = Mojo::Promise->new; my %via_count = map { $_->{name} => 0 } @destinations; if ( $eva >= 8000000 if ( $iris_eva >= 8000000 and List::Util::any { $_->{eva} >= 8000000 } @destinations ) { $self->iris->get_departures_p( station => $eva, station => $iris_eva, lookbehind => 10, lookahead => $lookahead, with_related => 1 Loading Loading @@ -323,6 +331,12 @@ sub get_connecting_trains_p { if ( $hafas_train->{iris_seen} ) { next; } if ( $iris_eva != $eva and $hafas_train->station_eva == $iris_eva ) { # better safe than sorry, for now next; } for my $stop ( $hafas_train->route ) { for my $dest (@destinations) { if ( $stop->{name} Loading lib/Travelynx/Model/Journeys.pm +6 −3 Original line number Diff line number Diff line Loading @@ -1726,13 +1726,16 @@ sub get_connection_targets { my $min_count = $opt{min_count} // 3; if ( $opt{destination_name} ) { return ( { eva => $opt{eva}, name => $opt{destination_name} } ); return ( [], [ { eva => $opt{eva}, name => $opt{destination_name} } ] ); } my $dest_id = $opt{eva} // $self->get_latest_dest_id(%opt); if ( not $dest_id ) { return; return ( [], [] ); } my $dest_ids = [ $dest_id, $self->{stations}->get_meta( eva => $dest_id ) ]; Loading @@ -1754,7 +1757,7 @@ sub get_connection_targets { = $res->hashes->grep( sub { shift->{count} >= $min_count } ) ->map( sub { shift->{dest} } )->each; @destinations = $self->{stations}->get_by_evas(@destinations); return @destinations; return ( $dest_ids, \@destinations ); } sub update_visibility { Loading Loading
lib/Travelynx/Controller/Traveling.pm +18 −4 Original line number Diff line number Diff line Loading @@ -65,8 +65,10 @@ sub get_connecting_trains_p { return $promise->reject; } my @destinations = uniq_by { $_->{name} } $self->journeys->get_connection_targets(%opt); my ( $dest_ids, $destinations ) = $self->journeys->get_connection_targets(%opt); my @destinations = uniq_by { $_->{name} } @{$destinations}; if ($exclude_via) { @destinations = grep { $_->{name} ne $exclude_via } @destinations; Loading @@ -76,6 +78,12 @@ sub get_connecting_trains_p { return $promise->reject; } my $iris_eva = $eva; if ( $eva < 8000000 ) { $iris_eva = ( List::Util::first { $_ >= 8000000 } @{$dest_ids} ) // $eva; } my $can_check_in = not $arr_epoch || ( $arr_countdown // 1 ) < 0; my $lookahead = $can_check_in ? 40 : ( ( ${arr_countdown} // 0 ) / 60 + 40 ); Loading @@ -83,11 +91,11 @@ sub get_connecting_trains_p { my $iris_promise = Mojo::Promise->new; my %via_count = map { $_->{name} => 0 } @destinations; if ( $eva >= 8000000 if ( $iris_eva >= 8000000 and List::Util::any { $_->{eva} >= 8000000 } @destinations ) { $self->iris->get_departures_p( station => $eva, station => $iris_eva, lookbehind => 10, lookahead => $lookahead, with_related => 1 Loading Loading @@ -323,6 +331,12 @@ sub get_connecting_trains_p { if ( $hafas_train->{iris_seen} ) { next; } if ( $iris_eva != $eva and $hafas_train->station_eva == $iris_eva ) { # better safe than sorry, for now next; } for my $stop ( $hafas_train->route ) { for my $dest (@destinations) { if ( $stop->{name} Loading
lib/Travelynx/Model/Journeys.pm +6 −3 Original line number Diff line number Diff line Loading @@ -1726,13 +1726,16 @@ sub get_connection_targets { my $min_count = $opt{min_count} // 3; if ( $opt{destination_name} ) { return ( { eva => $opt{eva}, name => $opt{destination_name} } ); return ( [], [ { eva => $opt{eva}, name => $opt{destination_name} } ] ); } my $dest_id = $opt{eva} // $self->get_latest_dest_id(%opt); if ( not $dest_id ) { return; return ( [], [] ); } my $dest_ids = [ $dest_id, $self->{stations}->get_meta( eva => $dest_id ) ]; Loading @@ -1754,7 +1757,7 @@ sub get_connection_targets { = $res->hashes->grep( sub { shift->{count} >= $min_count } ) ->map( sub { shift->{dest} } )->each; @destinations = $self->{stations}->get_by_evas(@destinations); return @destinations; return ( $dest_ids, \@destinations ); } sub update_visibility { Loading