From 6f3710c5cbecf7e531a3fcd1a40505b2afd18592 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 25 Aug 2024 16:36:02 +0200 Subject: IRIS: Re-add support for stations unknown to T::S::DE::IRIS::Stations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a regression introduced by 47f76da4f8cc31146d2834dfdf9731d330288c9d 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 --- lib/Travelynx/Helper/IRIS.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Travelynx/Helper/IRIS.pm') diff --git a/lib/Travelynx/Helper/IRIS.pm b/lib/Travelynx/Helper/IRIS.pm index f96aeb6..34739eb 100644 --- a/lib/Travelynx/Helper/IRIS.pm +++ b/lib/Travelynx/Helper/IRIS.pm @@ -41,6 +41,10 @@ sub get_departures { my @station_matches = Travel::Status::DE::IRIS::Stations::get_station($station); + if ( $station =~ m{ ^ \d+ $ }x ) { + @station_matches = ( [ undef, undef, $station ] ); + } + if ( @station_matches == 1 ) { $station = $station_matches[0][2]; my $status = Travel::Status::DE::IRIS->new( @@ -108,6 +112,10 @@ sub get_departures_p { my @station_matches = Travel::Status::DE::IRIS::Stations::get_station($station); + if ( $station =~ m{ ^ \d+ $ }x ) { + @station_matches = ( [ undef, undef, $station ] ); + } + if ( @station_matches == 1 ) { $station = $station_matches[0][2]; my $promise = Mojo::Promise->new; -- cgit v1.2.3