Loading bin/db-iris +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ use Travel::Status::DE::IRIS::Stations; my ( $date, $time ); my $datetime = DateTime->now( time_zone => 'Europe/Berlin' ); my $developer_mode = 0; my $lookahead = 3 * 60; my $lookahead = 2 * 60; my $realtime = 0; my $with_related = 1; my ( $filter_via, $track_via, $status_via ); Loading lib/Travel/Status/DE/IRIS.pm +16 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ sub new { developer_mode => $opt{developer_mode}, iris_base => $opt{iris_base} // 'http://iris.noncd.db.de/iris-tts/timetable', lookahead => $opt{lookahead} // ( 3 * 60 ), lookahead => $opt{lookahead} // ( 2 * 60 ), lookbehind => $opt{lookbehind} // ( 0 * 60 ), main_cache => $opt{main_cache}, rt_cache => $opt{realtime_cache}, Loading Loading @@ -88,13 +88,25 @@ sub new { return $self; } my $lookahead_steps = int( $self->{lookahead} / 60 ); if ( ( 60 - $self->{datetime}->minute ) < ( $self->{lookahead} % 60 ) ) { say "lookahead: ${lookahead_steps}++"; $lookahead_steps++; } my $lookbehind_steps = int( $self->{lookbehind} / 60 ); if ( $self->{datetime}->minute < ( $self->{lookbehind} % 60 ) ) { say "lookbehind: ${lookbehind_steps}++"; $lookbehind_steps++; } my $dt_req = $self->{datetime}->clone; for ( 1 .. int( $self->{lookahead} / 60 ) ) { $self->get_timetable( $self->{station}{uic}, $dt_req ); for ( 1 .. $lookahead_steps ) { $dt_req->add( hours => 1 ); $self->get_timetable( $self->{station}{uic}, $dt_req ); } $dt_req = $self->{datetime}->clone; for ( 1 .. int( $self->{lookbehind} / 60 ) ) { for ( 1 .. $lookbehind_steps ) { $dt_req->subtract( hours => 1 ); $self->get_timetable( $self->{station}{uic}, $dt_req ); } Loading t/20-iris-class.t +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ use warnings; use 5.014; use DateTime; use Test::More tests => 274; use Test::More tests => 266; BEGIN { use_ok('Travel::Status::DE::IRIS'); Loading @@ -22,7 +22,7 @@ my $status = Travel::Status::DE::IRIS->new( minute => 1, time_zone => 'Europe/Berlin', ), lookahead => 3 * 60 + 59, lookahead => 3 * 60, ); isa_ok( $status, '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 => 436; use Test::More tests => 424; use Test::Fatal; use Travel::Status::DE::IRIS; Loading @@ -21,12 +21,12 @@ my $status = Travel::Status::DE::IRIS->new( minute => 1, time_zone => 'Europe/Berlin' ), lookahead => 3 * 60 + 59, lookahead => 3 * 60, ); my @results = $status->results; is(@results, 135, 'got 135 results'); is(@results, 131, 'got 131 results'); my $ice645 = $results[0]; my $s1 = $results[1]; Loading Loading
bin/db-iris +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ use Travel::Status::DE::IRIS::Stations; my ( $date, $time ); my $datetime = DateTime->now( time_zone => 'Europe/Berlin' ); my $developer_mode = 0; my $lookahead = 3 * 60; my $lookahead = 2 * 60; my $realtime = 0; my $with_related = 1; my ( $filter_via, $track_via, $status_via ); Loading
lib/Travel/Status/DE/IRIS.pm +16 −4 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ sub new { developer_mode => $opt{developer_mode}, iris_base => $opt{iris_base} // 'http://iris.noncd.db.de/iris-tts/timetable', lookahead => $opt{lookahead} // ( 3 * 60 ), lookahead => $opt{lookahead} // ( 2 * 60 ), lookbehind => $opt{lookbehind} // ( 0 * 60 ), main_cache => $opt{main_cache}, rt_cache => $opt{realtime_cache}, Loading Loading @@ -88,13 +88,25 @@ sub new { return $self; } my $lookahead_steps = int( $self->{lookahead} / 60 ); if ( ( 60 - $self->{datetime}->minute ) < ( $self->{lookahead} % 60 ) ) { say "lookahead: ${lookahead_steps}++"; $lookahead_steps++; } my $lookbehind_steps = int( $self->{lookbehind} / 60 ); if ( $self->{datetime}->minute < ( $self->{lookbehind} % 60 ) ) { say "lookbehind: ${lookbehind_steps}++"; $lookbehind_steps++; } my $dt_req = $self->{datetime}->clone; for ( 1 .. int( $self->{lookahead} / 60 ) ) { $self->get_timetable( $self->{station}{uic}, $dt_req ); for ( 1 .. $lookahead_steps ) { $dt_req->add( hours => 1 ); $self->get_timetable( $self->{station}{uic}, $dt_req ); } $dt_req = $self->{datetime}->clone; for ( 1 .. int( $self->{lookbehind} / 60 ) ) { for ( 1 .. $lookbehind_steps ) { $dt_req->subtract( hours => 1 ); $self->get_timetable( $self->{station}{uic}, $dt_req ); } Loading
t/20-iris-class.t +2 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ use warnings; use 5.014; use DateTime; use Test::More tests => 274; use Test::More tests => 266; BEGIN { use_ok('Travel::Status::DE::IRIS'); Loading @@ -22,7 +22,7 @@ my $status = Travel::Status::DE::IRIS->new( minute => 1, time_zone => 'Europe/Berlin', ), lookahead => 3 * 60 + 59, lookahead => 3 * 60, ); isa_ok( $status, '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 => 436; use Test::More tests => 424; use Test::Fatal; use Travel::Status::DE::IRIS; Loading @@ -21,12 +21,12 @@ my $status = Travel::Status::DE::IRIS->new( minute => 1, time_zone => 'Europe/Berlin' ), lookahead => 3 * 60 + 59, lookahead => 3 * 60, ); my @results = $status->results; is(@results, 135, 'got 135 results'); is(@results, 131, 'got 131 results'); my $ice645 = $results[0]; my $s1 = $results[1]; Loading