Travelynx.pm: Document the real cause of sched_arr-isa-DateTime bug

This commit is contained in:
Daniel Friesel 2019-10-06 16:32:58 +02:00
parent a2d08bca26
commit aaaeec5c30

View file

@ -1874,12 +1874,6 @@ sub startup {
)->then( )->then(
sub { sub {
my ($traininfo) = @_; 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} ) { if ( not $traininfo or $traininfo->{error} ) {
$self->app->log->debug("traininfo error"); $self->app->log->debug("traininfo error");
return Mojo::Promise->reject("traininfo error"); return Mojo::Promise->reject("traininfo error");
@ -2518,14 +2512,13 @@ sub startup {
for my $station (@route_after) { for my $station (@route_after) {
if ( @{$station} > 1 ) { if ( @{$station} > 1 ) {
my $times = $station->[1];
# TODO this is a workaround. # Note: $station->[1]{sched_arr} may already have been
# A station may be present several times in @route_after # converted to a DateTime object in $station->[1] is
# (e.g. Frankfurt Flughafen at some nightly connections). # $dep_info. This can happen when a station is present
# At the moment, there's a bug causing the time ref of # several times in a train's route, e.g. for Frankfurt
# each stop to be the same -> ensure that it is not converted # Flughafen in some nightly connections.
# to DateTime twice. my $times = $station->[1];
if ( $times->{sched_arr} if ( $times->{sched_arr}
and ref( $times->{sched_arr} ) ne 'DateTime' ) and ref( $times->{sched_arr} ) ne 'DateTime' )
{ {