From 75a7a70677a44d67af498f05773bc172d5092393 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 16 Oct 2022 22:30:16 +0200 Subject: journey: properly handle origin/destination and route_{start,end} --- lib/Travel/Status/DE/HAFAS/Journey.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') 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 ); -- cgit v1.2.3