summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog6
-rw-r--r--lib/Travel/Status/DE/EFA.pm2
-rw-r--r--lib/Travel/Status/DE/EFA/Result.pm4
-rw-r--r--t/20-vrr.t2
4 files changed, 10 insertions, 4 deletions
diff --git a/Changelog b/Changelog
index 019fde3..6a13250 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,9 @@
+git HEAD
+
+ * Result->delay: return undef when no data is available. This allows to
+ distinguish between on-time departures (delay 0) and departures without
+ realtime data (delay undef)
+
Travel::Status::DE::VRR 1.09 - Thu Apr 30 2015
* EFA: Fix crash when ->results is called after a network error occured
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index 4883ed0..4789ccc 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -336,7 +336,7 @@ sub results {
my $info = $e_info->textContent;
my $key = $e_line->getAttribute('key');
my $countdown = $e->getAttribute('countdown');
- my $delay = $e_info->getAttribute('delay') // 0;
+ my $delay = $e_info->getAttribute('delay');
my $type = $e_info->getAttribute('name');
my $platform_is_db = 0;
diff --git a/lib/Travel/Status/DE/EFA/Result.pm b/lib/Travel/Status/DE/EFA/Result.pm
index e0d6ad4..95e35cd 100644
--- a/lib/Travel/Status/DE/EFA/Result.pm
+++ b/lib/Travel/Status/DE/EFA/Result.pm
@@ -18,7 +18,7 @@ sub new {
my $ref = \%conf;
- if ( $ref->{delay} eq '-9999' ) {
+ if ( defined $ref->{delay} and $ref->{delay} eq '-9999' ) {
$ref->{delay} = 0;
$ref->{is_cancelled} = 1;
}
@@ -86,7 +86,7 @@ Actual departure date (DD.MM.YYYY).
=item $departure->delay
Expected delay from scheduled departure time in minutes. A delay of 0
-indicates either departure on time or that no delay information is available.
+indicates departure on time. undef when no realtime information is available.
=item $departure->destination
diff --git a/t/20-vrr.t b/t/20-vrr.t
index cc710f2..66f2fe6 100644
--- a/t/20-vrr.t
+++ b/t/20-vrr.t
@@ -43,7 +43,7 @@ is($results[3]->info, decode('UTF-8', 'Ab (H) Heißen Kirche, Umstieg in den SEV
is($results[3]->line, '18', 'fourth result: line ok');
is($results[3]->date, '16.11.2011', 'fourth result: real date ok');
is($results[3]->time, '09:39', 'fourth result: real time ok');
-is($results[3]->delay, 0, 'fourth result: delay 0');
+is($results[3]->delay, undef, 'fourth result: delay undef');
is($results[3]->sched_date, '16.11.2011', 'fourth result: scheduled date ok');
is($results[3]->sched_time, '09:39', 'fourth result: scheduled time ok');
#is($results[3]->platform, '2', 'fourth result: platform ok');