summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Helper
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-04-06 10:40:52 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-04-06 10:41:20 +0200
commitfb639e553f15022e865233742914a9e7af99c9f3 (patch)
treed482f63dab1c6c9853327613b72d348e2f00bd61 /lib/DBInfoscreen/Helper
parentb06b69af7cd8b3a7a767bc4cdae80a35bc7154d8 (diff)
trainsearch: handle unknown train types4.0.0
IRIS reports unknown train types as "-"; HAFAS wants the train type to be left out in this case
Diffstat (limited to 'lib/DBInfoscreen/Helper')
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm
index 8d4c89f..249d308 100644
--- a/lib/DBInfoscreen/Helper/HAFAS.pm
+++ b/lib/DBInfoscreen/Helper/HAFAS.pm
@@ -204,6 +204,10 @@ sub trainsearch_p {
$opt{date_yyyy} = $now->strftime('%d.%m.%Y');
}
+ # IRIS reports trains with unknown type as type "-". HAFAS thinks otherwise
+ # and prefers the type to be left out entirely in this case.
+ $opt{train_req} =~ s{^- }{};
+
my $promise = Mojo::Promise->new;
$self->get_json_p( $self->{realtime_cache},