diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-05-18 17:11:28 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-05-18 17:11:28 +0200 |
commit | 7486920a6a40d706bb8c9e99ba129dbe3f89bff7 (patch) | |
tree | 396f8d3ef5bafdce89bb499d3a7478fbdf0c8d81 /lib | |
parent | e68043b8fb840bad3091f53f5e9adca3451d40d1 (diff) |
Proactively recompute yearly stats to avoid long user wait times
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travelynx/Command/work.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index a9969f3..b24e4ad 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -125,6 +125,17 @@ sub run { eval { } } + + # Computing yearly stats may take a while, but we've got all time in the + # world here. This means users won't have to wait when loading their + # own by-year journey log. + for my $user ( $db->select( 'users', 'id', { status => 1 } )->hashes->each ) + { + $self->app->get_journey_stats( + uid => $user->{id}, + year => $now->year + ); + } } 1; |