From dfc671161cc3829f3b84af04014b94ace621eb8e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 5 Aug 2018 18:22:08 +0200 Subject: Compare lookahead to scheduled and not realtime data --- lib/Travel/Status/DE/IRIS.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/Travel/Status/DE/IRIS.pm') diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index e257c67..21bc599 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -131,10 +131,11 @@ sub new { } @{ $self->{results} } = grep { - my $d - = ( $_->departure // $_->arrival ) - ->subtract_datetime( $self->{datetime} ); - not $d->is_negative and $d->in_units('minutes') < $self->{lookahead} + my $d = ( $_->departure // $_->arrival ); + my $sd = $_->sched_departure // $_->sched_arrival // $d; + $d = $d->subtract_datetime( $self->{datetime} ); + $sd = $sd->subtract_datetime( $self->{datetime} ); + not $d->is_negative and $sd->in_units('minutes') < $self->{lookahead} } @{ $self->{results} }; @{ $self->{results} } @@ -607,7 +608,8 @@ IRIS base url, defaults to C<< http://iris.noncd.db.de/iris-tts/timetable >>. =item B => I -Compute only results which are less than I minutes in the future. +Compute only results which are scheduled less than I minutes in the +future. Default: 180 (3 hours). Note that the DeutscheBahn IRIS backend only provides schedules up to four to -- cgit v1.2.3