Loading lib/Travel/Status/DE/IRIS.pm +7 −5 Original line number Diff line number Diff line Loading @@ -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} } Loading Loading @@ -607,7 +608,8 @@ IRIS base url, defaults to C<< http://iris.noncd.db.de/iris-tts/timetable >>. =item B<lookahead> => I<int> Compute only results which are less than I<int> minutes in the future. Compute only results which are scheduled less than I<int> minutes in the future. Default: 180 (3 hours). Note that the DeutscheBahn IRIS backend only provides schedules up to four to Loading t/20-iris-class.t +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ use warnings; use 5.014; use DateTime; use Test::More tests => 266; use Test::More tests => 268; BEGIN { use_ok('Travel::Status::DE::IRIS'); Loading t/31-result-basics.t +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ use 5.014; use utf8; use DateTime; use Test::More tests => 429; use Test::More tests => 432; use Test::Fatal; use Travel::Status::DE::IRIS; Loading @@ -26,7 +26,7 @@ my $status = Travel::Status::DE::IRIS->new( my @results = $status->results; is(@results, 131, 'got 131 results'); is(scalar @results, 132, 'got 132 results'); my $ice645 = $results[0]; my $s1 = $results[1]; Loading Loading @@ -113,4 +113,4 @@ $status = Travel::Status::DE::IRIS->new( @results = $status->results; is(@results, 0, 'lookahead 0 -> no results'); is(scalar @results, 10, 'lookahead 0 -> only overdue results'); Loading
lib/Travel/Status/DE/IRIS.pm +7 −5 Original line number Diff line number Diff line Loading @@ -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} } Loading Loading @@ -607,7 +608,8 @@ IRIS base url, defaults to C<< http://iris.noncd.db.de/iris-tts/timetable >>. =item B<lookahead> => I<int> Compute only results which are less than I<int> minutes in the future. Compute only results which are scheduled less than I<int> minutes in the future. Default: 180 (3 hours). Note that the DeutscheBahn IRIS backend only provides schedules up to four to Loading
t/20-iris-class.t +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ use warnings; use 5.014; use DateTime; use Test::More tests => 266; use Test::More tests => 268; BEGIN { use_ok('Travel::Status::DE::IRIS'); Loading
t/31-result-basics.t +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ use 5.014; use utf8; use DateTime; use Test::More tests => 429; use Test::More tests => 432; use Test::Fatal; use Travel::Status::DE::IRIS; Loading @@ -26,7 +26,7 @@ my $status = Travel::Status::DE::IRIS->new( my @results = $status->results; is(@results, 131, 'got 131 results'); is(scalar @results, 132, 'got 132 results'); my $ice645 = $results[0]; my $s1 = $results[1]; Loading Loading @@ -113,4 +113,4 @@ $status = Travel::Status::DE::IRIS->new( @results = $status->results; is(@results, 0, 'lookahead 0 -> no results'); is(scalar @results, 10, 'lookahead 0 -> only overdue results');