From d0b6b7e0523cbee6c5902b53e993cfecc7cb5843 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 7 Apr 2019 16:55:35 +0200 Subject: Cache journey stats --- lib/Travelynx/Controller/Traveling.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/Travelynx/Controller') diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index a83adb0..dee69a6 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -285,7 +285,9 @@ sub monthly_history { qw(Januar Februar März April Mai Juni Juli August September Oktober November Dezember) ); - if ( not( $year =~ m{ ^ [0-9]{4} $ }x and $month =~ m{ ^ [0-9]{1,2} $ }x ) ) + if ( $cancelled + or + not( $year =~ m{ ^ [0-9]{4} $ }x and $month =~ m{ ^ [0-9]{1,2} $ }x ) ) { @journeys = $self->get_user_travels( cancelled => $cancelled ); } @@ -301,12 +303,13 @@ sub monthly_history { ); my $interval_end = $interval_start->clone->add( months => 1 ); @journeys = $self->get_user_travels( - cancelled => $cancelled, - verbose => 1, - after => $interval_start, - before => $interval_end + after => $interval_start, + before => $interval_end + ); + $stats = $self->get_journey_stats( + year => $year, + month => $month ); - $stats = $self->compute_journey_stats(@journeys); } $self->respond_to( -- cgit v1.2.3