From 80c9068e98d2c10f116dd52f9d51ff892936dae5 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 12 Feb 2023 09:01:32 +0100 Subject: Fix HAFAS backend with rt=1 --- lib/DBInfoscreen/Controller/Stationboard.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 8eac6b0..a81c7d5 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1328,7 +1328,10 @@ sub handle_result { } if ($show_realtime) { - if ( $admode eq 'arr' ) { + if ( $self->param('hafas') ) { + @results = sort { $a->datetime <=> $b->datetime } @results; + } + elsif ( $admode eq 'arr' ) { @results = sort { ( $a->arrival // $a->departure ) <=> ( $b->arrival // $b->departure ) @@ -1404,7 +1407,10 @@ sub handle_result { } if ($show_realtime) { - if ( ( $admode eq 'arr' and $result->arrival ) + if ( $self->param('hafas') ) { + $time = $result->datetime->strftime('%H:%M'); + } + elsif ( ( $admode eq 'arr' and $result->arrival ) or not $result->departure ) { $time = $result->arrival->strftime('%H:%M'); -- cgit v1.2.3