summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-02-05 09:23:07 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-02-05 09:23:07 +0100
commit21f2f6d4bf1021936064064a081730734b42ddfc (patch)
treec35cadc4b448eb5aa3d329e245cdba2edc7c645f /lib
parentf7deac35786b3bf799f40cb563f440b23d5da716 (diff)
route_end: Some backend do not provide a route; fall back to dirTxt
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/HAFAS/Journey.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm
index 94052ed..c4320ba 100644
--- a/lib/Travel/Status/DE/HAFAS/Journey.pm
+++ b/lib/Travel/Status/DE/HAFAS/Journey.pm
@@ -89,6 +89,7 @@ sub new {
my $class = $product->{cls};
my @stops;
+ my $route_end;
for my $stop ( @{ $journey->{stopL} // [] } ) {
my $loc = $locL[ $stop->{locX} ];
my $sched_arr = $stop->{aTimeS};
@@ -151,6 +152,7 @@ sub new {
load => $tco,
}
);
+ $route_end = $loc->{name};
}
if ( $journey->{stbStop} ) {
@@ -171,7 +173,7 @@ sub new {
direction => $direction,
is_cancelled => $is_cancelled,
is_partially_cancelled => $partially_cancelled,
- route_end => $stops[-1]{name},
+ route_end => $route_end // $direction,
messages => \@messages,
route => \@stops,
};