diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-07 16:55:35 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-07 16:55:35 +0200 |
commit | d0b6b7e0523cbee6c5902b53e993cfecc7cb5843 (patch) | |
tree | 27a2d6d7f118b81757d2f9a7dc39cee6bc2971b3 /lib/Travelynx/Controller | |
parent | 9225a82c669079f09b29f68296f273630f274ec9 (diff) |
Cache journey stats
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 15 |
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( |