From aaaeec5c305ff1f8fc8813b025a3328f597cd433 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 6 Oct 2019 16:32:58 +0200 Subject: [PATCH] Travelynx.pm: Document the real cause of sched_arr-isa-DateTime bug --- lib/Travelynx.pm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 931745e..0c23a3a 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1874,12 +1874,6 @@ sub startup { )->then( sub { my ($traininfo) = @_; - - # FIXME when a station appears several times in a route - # (e.g. Frankfurt Flughafen on some nightly connections), this - # method chain sets the same timing reference on each stop, - # causing murder and mayhem later on (e.g. in get_user_status) - if ( not $traininfo or $traininfo->{error} ) { $self->app->log->debug("traininfo error"); return Mojo::Promise->reject("traininfo error"); @@ -2518,14 +2512,13 @@ sub startup { for my $station (@route_after) { if ( @{$station} > 1 ) { - my $times = $station->[1]; - # TODO this is a workaround. - # A station may be present several times in @route_after - # (e.g. Frankfurt Flughafen at some nightly connections). - # At the moment, there's a bug causing the time ref of - # each stop to be the same -> ensure that it is not converted - # to DateTime twice. + # Note: $station->[1]{sched_arr} may already have been + # converted to a DateTime object in $station->[1] is + # $dep_info. This can happen when a station is present + # several times in a train's route, e.g. for Frankfurt + # Flughafen in some nightly connections. + my $times = $station->[1]; if ( $times->{sched_arr} and ref( $times->{sched_arr} ) ne 'DateTime' ) {