Loading lib/Travelynx/Controller/Traveling.pm +25 −17 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ sub has_str_in_list { return; } # when called with "eva" provided: look up connections from eva, either # for provided backend_id / hafas or (if not provided) for user backend id. # When calld without "eva": look up connections from current/latest arrival # eva, using the checkin's backend id. sub get_connecting_trains_p { my ( $self, %opt ) = @_; Loading @@ -46,7 +50,8 @@ sub get_connecting_trains_p { } if ( not defined $opt{backend_id} ) { if ( $opt{hafas} ) { $opt{backend_id} = $self->stations->get_backend_id(hafas => $opt{hafas}); $opt{backend_id} = $self->stations->get_backend_id( hafas => $opt{hafas} ); } else { $opt{backend_id} = $user->{backend_id}; Loading Loading @@ -75,11 +80,12 @@ sub get_connecting_trains_p { return $promise->reject; } $self->log->debug("get_connecting_trains_p(backend_id => $opt{backend_id}, eva => $eva)"); $self->log->debug( "get_connecting_trains_p(backend_id => $opt{backend_id}, eva => $eva)"); my $destinations = $self->journeys->get_connection_targets(%opt); my @destinations = $self->journeys->get_connection_targets(%opt); my @destinations = uniq_by { $_->{name} } @{$destinations}; @destinations = uniq_by { $_->{name} } @destinations; if ($exclude_via) { @destinations = grep { $_->{name} ne $exclude_via } @destinations; Loading Loading @@ -253,8 +259,10 @@ sub get_connecting_trains_p { )->wait; } else { my $hafas_service = $self->stations->get_hafas_name( backend_id => $opt{backend_id} ); $self->hafas->get_departures_p( service => $self->stations->get_hafas_name(backend_id => $opt{backend_id}), service => $hafas_service, eva => $eva, lookbehind => 10, lookahead => $lookahead Loading Loading @@ -285,7 +293,7 @@ sub get_connecting_trains_p { @hafas_trains, [ $hafas_train, $dest, $arrival, $opt{hafas} $arrival, $hafas_service ] ); } Loading Loading @@ -340,8 +348,7 @@ sub homepage { and $status->{arrival_countdown} < ( 40 * 60 ) ) { $self->render_later; $self->get_connecting_trains_p( backend_id => $status->{backend_id} )->then( $self->get_connecting_trains_p->then( sub { my ( $connections_iris, $connections_hafas ) = @_; $self->render( Loading Loading @@ -419,8 +426,7 @@ sub status_card { and $status->{arrival_countdown} < ( 40 * 60 ) ) { $self->render_later; $self->get_connecting_trains_p( backend_id => $status->{backend_id} )->then( $self->get_connecting_trains_p->then( sub { my ( $connections_iris, $connections_hafas ) = @_; $self->render( Loading Loading @@ -476,8 +482,7 @@ sub status_card { my $now = DateTime->now( time_zone => 'Europe/Berlin' ); if ( $now->epoch - $status->{timestamp}->epoch < ( 30 * 60 ) ) { $self->render_later; $self->get_connecting_trains_p( hafas => $self->param('hafas') ) ->then( $self->get_connecting_trains_p->then( sub { my ( $connections_iris, $connections_hafas ) = @_; $self->render( Loading Loading @@ -994,12 +999,15 @@ sub station { $connections_p = $self->get_connecting_trains_p( eva => $user_status->{cancellation}{dep_eva}, destination_name => $user_status->{cancellation}{arr_name} $user_status->{cancellation}{arr_name}, hafas => $hafas_service, ); } else { $connections_p = $self->get_connecting_trains_p( eva => $status->{station_eva} ); eva => $status->{station_eva}, hafas => $hafas_service ); } } Loading lib/Travelynx/Model/Journeys.pm +8 −5 Original line number Diff line number Diff line Loading @@ -837,7 +837,10 @@ sub get_latest_checkout_stations { my $res = $db->select( 'journeys_str', [ 'arr_name', 'arr_eva', 'train_id', 'backend_id', 'backend_name', 'is_hafas' ], [ 'arr_name', 'arr_eva', 'train_id', 'backend_id', 'backend_name', 'is_hafas' ], { user_id => $uid, cancelled => 0 Loading Loading @@ -1807,7 +1810,7 @@ sub get_connection_targets { backend_id => $opt{backend_id}, evas => [@destinations] ); return \@destinations; return @destinations; } sub update_visibility { Loading Loading
lib/Travelynx/Controller/Traveling.pm +25 −17 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ sub has_str_in_list { return; } # when called with "eva" provided: look up connections from eva, either # for provided backend_id / hafas or (if not provided) for user backend id. # When calld without "eva": look up connections from current/latest arrival # eva, using the checkin's backend id. sub get_connecting_trains_p { my ( $self, %opt ) = @_; Loading @@ -46,7 +50,8 @@ sub get_connecting_trains_p { } if ( not defined $opt{backend_id} ) { if ( $opt{hafas} ) { $opt{backend_id} = $self->stations->get_backend_id(hafas => $opt{hafas}); $opt{backend_id} = $self->stations->get_backend_id( hafas => $opt{hafas} ); } else { $opt{backend_id} = $user->{backend_id}; Loading Loading @@ -75,11 +80,12 @@ sub get_connecting_trains_p { return $promise->reject; } $self->log->debug("get_connecting_trains_p(backend_id => $opt{backend_id}, eva => $eva)"); $self->log->debug( "get_connecting_trains_p(backend_id => $opt{backend_id}, eva => $eva)"); my $destinations = $self->journeys->get_connection_targets(%opt); my @destinations = $self->journeys->get_connection_targets(%opt); my @destinations = uniq_by { $_->{name} } @{$destinations}; @destinations = uniq_by { $_->{name} } @destinations; if ($exclude_via) { @destinations = grep { $_->{name} ne $exclude_via } @destinations; Loading Loading @@ -253,8 +259,10 @@ sub get_connecting_trains_p { )->wait; } else { my $hafas_service = $self->stations->get_hafas_name( backend_id => $opt{backend_id} ); $self->hafas->get_departures_p( service => $self->stations->get_hafas_name(backend_id => $opt{backend_id}), service => $hafas_service, eva => $eva, lookbehind => 10, lookahead => $lookahead Loading Loading @@ -285,7 +293,7 @@ sub get_connecting_trains_p { @hafas_trains, [ $hafas_train, $dest, $arrival, $opt{hafas} $arrival, $hafas_service ] ); } Loading Loading @@ -340,8 +348,7 @@ sub homepage { and $status->{arrival_countdown} < ( 40 * 60 ) ) { $self->render_later; $self->get_connecting_trains_p( backend_id => $status->{backend_id} )->then( $self->get_connecting_trains_p->then( sub { my ( $connections_iris, $connections_hafas ) = @_; $self->render( Loading Loading @@ -419,8 +426,7 @@ sub status_card { and $status->{arrival_countdown} < ( 40 * 60 ) ) { $self->render_later; $self->get_connecting_trains_p( backend_id => $status->{backend_id} )->then( $self->get_connecting_trains_p->then( sub { my ( $connections_iris, $connections_hafas ) = @_; $self->render( Loading Loading @@ -476,8 +482,7 @@ sub status_card { my $now = DateTime->now( time_zone => 'Europe/Berlin' ); if ( $now->epoch - $status->{timestamp}->epoch < ( 30 * 60 ) ) { $self->render_later; $self->get_connecting_trains_p( hafas => $self->param('hafas') ) ->then( $self->get_connecting_trains_p->then( sub { my ( $connections_iris, $connections_hafas ) = @_; $self->render( Loading Loading @@ -994,12 +999,15 @@ sub station { $connections_p = $self->get_connecting_trains_p( eva => $user_status->{cancellation}{dep_eva}, destination_name => $user_status->{cancellation}{arr_name} $user_status->{cancellation}{arr_name}, hafas => $hafas_service, ); } else { $connections_p = $self->get_connecting_trains_p( eva => $status->{station_eva} ); eva => $status->{station_eva}, hafas => $hafas_service ); } } Loading
lib/Travelynx/Model/Journeys.pm +8 −5 Original line number Diff line number Diff line Loading @@ -837,7 +837,10 @@ sub get_latest_checkout_stations { my $res = $db->select( 'journeys_str', [ 'arr_name', 'arr_eva', 'train_id', 'backend_id', 'backend_name', 'is_hafas' ], [ 'arr_name', 'arr_eva', 'train_id', 'backend_id', 'backend_name', 'is_hafas' ], { user_id => $uid, cancelled => 0 Loading Loading @@ -1807,7 +1810,7 @@ sub get_connection_targets { backend_id => $opt{backend_id}, evas => [@destinations] ); return \@destinations; return @destinations; } sub update_visibility { Loading