diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-09-07 21:19:43 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-09-07 21:19:43 +0200 |
commit | 2e14c2e3e4dafa976cecab2721682553d90eb01e (patch) | |
tree | 51f786b0738b3aea957e5ac6c79433fe6d09bc23 /lib/Travelynx | |
parent | b410176e634559bda0ff5d1628d45dc6ed3df5e3 (diff) |
Fix intermediate stop display for journeys without real-time data, e.g. H-Bahn
Diffstat (limited to 'lib/Travelynx')
-rw-r--r-- | lib/Travelynx/Model/InTransit.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm index aec193f..d06b94e 100644 --- a/lib/Travelynx/Model/InTransit.pm +++ b/lib/Travelynx/Model/InTransit.pm @@ -270,9 +270,11 @@ sub postprocess { if ( $times->{rt_arr} ) { $times->{rt_arr} = epoch_to_dt( $times->{rt_arr} ); - $times->{rt_arr_countdown} - = $times->{rt_arr}->epoch - $epoch; + $times->{arr_delay} + = $times->{rt_arr}->epoch - $times->{sched_arr}->epoch; } + $times->{arr} = $times->{rt_arr} || $times->{sched_arr}; + $times->{arr_countdown} = $times->{arr}->epoch - $epoch; } if ( $times->{sched_dep} and ref( $times->{sched_dep} ) ne 'DateTime' ) @@ -282,9 +284,11 @@ sub postprocess { if ( $times->{rt_dep} ) { $times->{rt_dep} = epoch_to_dt( $times->{rt_dep} ); - $times->{rt_dep_countdown} - = $times->{rt_dep}->epoch - $epoch; + $times->{dep_delay} + = $times->{rt_dep}->epoch - $times->{sched_dep}->epoch; } + $times->{dep} = $times->{rt_dep} || $times->{sched_dep}; + $times->{dep_countdown} = $times->{dep}->epoch - $epoch; } } } |