summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-12-13 14:11:37 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-12-13 14:11:37 +0100
commit49197e9b490f2e2da4747b28889defdb4b87451d (patch)
treefe0192a04da56d679459babe9121613b676fa098 /lib/Travel/Status
parent059789620c0ffaa8f69d59a3137a10e342ead366 (diff)
line no calculation: Don't get confused by 3- or 4-digit train numbers
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/IRIS/Result.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm
index 847682f..5a4247c 100644
--- a/lib/Travel/Status/DE/IRIS/Result.pm
+++ b/lib/Travel/Status/DE/IRIS/Result.pm
@@ -202,8 +202,8 @@ sub new {
$ref->{is_cancelled} = 0;
- if ( not defined $ref->{line_no} ) {
- my $train_prefix = substr( $ref->{train_no}, 0, 3 );
+ if ( not defined $ref->{line_no} and length( $ref->{train_no} ) > 2 ) {
+ my $train_prefix = substr( $ref->{train_no}, -5, 3 );
$ref->{line_no} = $linemap{ $ref->{type} }{$train_prefix};
}