summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-07-27 14:03:21 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2025-07-27 14:03:21 +0200
commit13ceeb44973b798bd405cbac80a590d448746805 (patch)
tree4fc01ac11ae057fca10d9e40a5199148a6a5bf0a
parent1f4669e3fc58c384e0d69f634a1a638cec600c97 (diff)
Journey#get_travel_distance: Only query (sched|rt)_(arr|dep) if defined
-rwxr-xr-xlib/Travelynx/Model/Journeys.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm
index 5e6195f..3a3ba30 100755
--- a/lib/Travelynx/Model/Journeys.pm
+++ b/lib/Travelynx/Model/Journeys.pm
@@ -1246,11 +1246,17 @@ sub get_travel_distance {
my $geo = GIS::Distance->new();
my $distance_beeline
= $geo->distance_metal( @{$from_latlon}, @{$to_latlon} );
- my @route
- = after_incl { ( $_->[1] and $_->[1] == $from_eva ) or $_->[0] eq $from }
+ my @route = after_incl {
+ ( ( $_->[1] and $_->[1] == $from_eva or $_->[0] eq $from )
+ and ( defined $_->[2]{sched_dep} or defined $_->[2]{rt_dep} )
+ and ( $_->[2]{sched_dep} // $_->[2]{rt_dep} )->epoch == $from_ts )
+ }
@{$route_ref};
- @route
- = before_incl { ( $_->[1] and $_->[1] == $to_eva ) or $_->[0] eq $to }
+ @route = before_incl {
+ ( ( $_->[1] and $_->[1] == $to_eva or $_->[0] eq $to )
+ and ( defined $_->[2]{sched_arr} or defined $_->[2]{rt_arr} )
+ and ( $_->[2]{sched_arr} // $_->[2]{rt_arr} )->epoch == $to_ts )
+ }
@route;
if (