From fc7ff5b6d7d285e1962e46c7ddbf304ebc7f1aa7 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 29 Jun 2025 05:52:12 +0200 Subject: Journeys->get: pre-compute delay data --- lib/Travelynx/Model/Journeys.pm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Travelynx/Model') diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index 7c92664..38df763 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -691,6 +691,12 @@ sub get { $ref->{checkout} = epoch_to_dt( $ref->{checkout_ts} ); $ref->{sched_arrival} = epoch_to_dt( $ref->{sched_arr_ts} ); $ref->{rt_arrival} = epoch_to_dt( $ref->{rt_arr_ts} ); + if ( $ref->{rt_dep_ts} and $ref->{sched_dep_ts} ) { + $ref->{delay_dep} = $ref->{rt_dep_ts} - $ref->{sched_dep_ts}; + } + if ( $ref->{rt_arr_ts} and $ref->{sched_arr_ts} ) { + $ref->{delay_arr} = $ref->{rt_arr_ts} - $ref->{sched_arr_ts}; + } } if ( $opt{with_route_datetime} ) { for my $stop ( @{ $ref->{route} } ) { -- cgit v1.2.3