diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-03-10 21:30:57 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-03-10 21:34:05 +0100 |
commit | 3e96b9b5bf432196b50a6a4df9dba85c2ae889f9 (patch) | |
tree | 04faa820c877386996899fb4fc0413bddb2c5202 /lib/Travel/Status/DE | |
parent | 869aa460a5a17989dff6e30eb6486b1e7be31542 (diff) |
lookahead: do not ignore trains where only arrival is < lookahead time
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r-- | lib/Travel/Status/DE/IRIS.pm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 6d712de..733a73c 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -144,11 +144,11 @@ sub new { } @{ $self->{results} } = grep { - 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} + my $d = $_->departure // $_->arrival; + my $s = $_->sched_arrival // $_->sched_departure // $_->arrival // $d; + $d = $d->subtract_datetime( $self->{datetime} ); + $s = $s->subtract_datetime( $self->{datetime} ); + not $d->is_negative and $s->in_units('minutes') < $self->{lookahead} } @{ $self->{results} }; @{ $self->{results} } |