summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-07 16:55:35 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-07 16:55:35 +0200
commitd0b6b7e0523cbee6c5902b53e993cfecc7cb5843 (patch)
tree27a2d6d7f118b81757d2f9a7dc39cee6bc2971b3 /lib/Travelynx/Controller
parent9225a82c669079f09b29f68296f273630f274ec9 (diff)
Cache journey stats
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm15
1 files changed, 9 insertions, 6 deletions
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(