diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-10-16 22:30:16 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-10-16 22:30:16 +0200 |
commit | 75a7a70677a44d67af498f05773bc172d5092393 (patch) | |
tree | e56093b97201cec21ee59fa1c50a55dbd145fe3b /lib/Travel/Status/DE | |
parent | da949651df5e187248067b1c58a778506083a502 (diff) |
journey: properly handle origin/destination and route_{start,end}
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Journey.pm | 15 |
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 ); |