From f1da50f9f18f0a2a5fd202daff4b6f0b517f35e0 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 9 Jun 2025 16:57:36 +0200 Subject: Fix worker for MOTIS checkins Apparently, even after a check-in has been performed, subsequent worker runs may encounter stop IDs that were not added to stations_external_ids by the check-in process. So we need to add_or_update all stops we ecounter. --- lib/Travelynx/Command/work.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/Travelynx/Command/work.pm') diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index b4b7656..2b01cb2 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -197,13 +197,15 @@ sub run { for my $stopover ( $journey->stopovers ) { if ( not defined $stopover->stop->{eva} ) { - my $stop - = $self->app->stations->get_by_external_id( - external_id => $stopover->stop->id, - motis => $entry->{backend_name}, - ); - $stopover->stop->{eva} = $stop->{eva}; + # Looks like MOTIS / transitous station IDs can change after the fact. + # So let's be safe rather than sorry, even if this causes way too many calls to the slow path + # (Stations::get_by_external_id uses string lookups). + # This function call implicitly sets $stopover->stop->{eva} for MOTIS backends. + $self->app->stations->add_or_update( + stop => $stopover->stop, + motis => $entry->{backend_name}, + ); } } -- cgit v1.2.3