summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-10-16 22:30:16 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-10-16 22:30:16 +0200
commit75a7a70677a44d67af498f05773bc172d5092393 (patch)
treee56093b97201cec21ee59fa1c50a55dbd145fe3b
parentda949651df5e187248067b1c58a778506083a502 (diff)
journey: properly handle origin/destination and route_{start,end}
-rw-r--r--lib/Travel/Status/DE/HAFAS/Journey.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm
index 006edd9..8dafb82 100644
--- a/lib/Travel/Status/DE/HAFAS/Journey.pm
+++ b/lib/Travel/Status/DE/HAFAS/Journey.pm
@@ -126,16 +126,19 @@ sub new {
is_cancelled => $is_cancelled,
train => $train,
operator => $operator,
- route_end => $destination,
+ destination => $destination,
+ route_end => $stops[-1]{name},
messages => \@messages,
route => \@stops,
};
- if ( $hafas->{arrivals} ) {
- $ref->{origin} = $ref->{route_end};
- }
- else {
- $ref->{destination} = $ref->{route_end};
+ if ( $journey->{stbStop} ) {
+ if ( $hafas->{arrivals} ) {
+ $ref->{origin} = $ref->{route_end};
+ }
+ else {
+ $ref->{destination} = $ref->{route_end};
+ }
}
bless( $ref, $obj );