IRIS: Re-add support for stations unknown to T::S::DE::IRIS::Stations

This fixes a regression introduced by 47f76da4f8

Closes #159

Journeys logged with travelynx v2.8.0 through 2.8.30 are affected by this bug
and will contain incorrect data even after applying this patch – it only
fixes data for new entries.

To Do: See if affected entries can be repaired with a DB migration
This commit is contained in:
Birte Kristina Friesel 2024-08-25 16:36:02 +02:00
parent 60ce72a954
commit 6f3710c5cb
No known key found for this signature in database
GPG key ID: B63118F7196EA660
2 changed files with 16 additions and 0 deletions

View file

@ -1409,6 +1409,14 @@ sub startup {
my ( $new_route, $journey, $polyline ) = @_; my ( $new_route, $journey, $polyline ) = @_;
my $db_route; my $db_route;
for my $stop ( $journey->route ) {
$self->stations->add_or_update(
stop => $stop,
db => $db,
iris => 1,
);
}
for my $i ( 0 .. $#{$new_route} ) { for my $i ( 0 .. $#{$new_route} ) {
my $old_name = $route->[$i][0]; my $old_name = $route->[$i][0];
my $old_eva = $route->[$i][1]; my $old_eva = $route->[$i][1];

View file

@ -41,6 +41,10 @@ sub get_departures {
my @station_matches my @station_matches
= Travel::Status::DE::IRIS::Stations::get_station($station); = Travel::Status::DE::IRIS::Stations::get_station($station);
if ( $station =~ m{ ^ \d+ $ }x ) {
@station_matches = ( [ undef, undef, $station ] );
}
if ( @station_matches == 1 ) { if ( @station_matches == 1 ) {
$station = $station_matches[0][2]; $station = $station_matches[0][2];
my $status = Travel::Status::DE::IRIS->new( my $status = Travel::Status::DE::IRIS->new(
@ -108,6 +112,10 @@ sub get_departures_p {
my @station_matches my @station_matches
= Travel::Status::DE::IRIS::Stations::get_station($station); = Travel::Status::DE::IRIS::Stations::get_station($station);
if ( $station =~ m{ ^ \d+ $ }x ) {
@station_matches = ( [ undef, undef, $station ] );
}
if ( @station_matches == 1 ) { if ( @station_matches == 1 ) {
$station = $station_matches[0][2]; $station = $station_matches[0][2];
my $promise = Mojo::Promise->new; my $promise = Mojo::Promise->new;