summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model/Journeys.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travelynx/Model/Journeys.pm')
-rwxr-xr-xlib/Travelynx/Model/Journeys.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm
index 24b8fb8..77907cd 100755
--- a/lib/Travelynx/Model/Journeys.pm
+++ b/lib/Travelynx/Model/Journeys.pm
@@ -1174,6 +1174,8 @@ sub generate_missing_stats {
my $stats_index = 0;
+ my %need_year;
+
for my $journey_index ( 0 .. $#journey_months ) {
if ( $stats_index < @stats_months
and $journey_months[$journey_index][0]
@@ -1185,6 +1187,7 @@ sub generate_missing_stats {
}
else {
my ( $year, $month ) = @{ $journey_months[$journey_index] };
+ $need_year{$year} = 1;
$self->get_stats(
uid => $uid,
db => $db,
@@ -1194,6 +1197,14 @@ sub generate_missing_stats {
);
}
}
+ for my $year ( keys %need_year ) {
+ $self->get_stats(
+ uid => $uid,
+ db => $db,
+ year => $year,
+ write_only => 1
+ );
+ }
}
sub get_nav_months {
@@ -1401,6 +1412,9 @@ sub get_travel_distance {
my %seen;
for my $stop ( @{$route_ref} ) {
+ if ( not defined $stop->[1] ) {
+ return ( 0, 0, $distance_beeline );
+ }
$seen{ $stop->[1] } //= 1;
$stop->[2]{n} = $seen{ $stop->[1] };
$seen{ $stop->[1] } += 1;