Enabled recalculation of leaderboards at any point
This commit is contained in:
parent
3f743f0b5f
commit
9b9b2bd322
3 changed files with 80 additions and 2 deletions
26
lib/Pear/LocalLoop/Command/recalc_leaderboards.pm
Normal file
26
lib/Pear/LocalLoop/Command/recalc_leaderboards.pm
Normal file
|
@ -0,0 +1,26 @@
|
|||
package Pear::LocalLoop::Command::recalc_leaderboards;
|
||||
use Mojo::Base 'Mojolicious::Command';
|
||||
|
||||
use Mojo::Util 'getopt';
|
||||
|
||||
has description => 'Build All leaderboards';
|
||||
|
||||
has usage => sub { shift->extract_usage };
|
||||
|
||||
sub run {
|
||||
my ( $self, @args ) = @_;
|
||||
|
||||
my $leaderboard_rs = $self->app->schema->resultset('Leaderboard');
|
||||
|
||||
$leaderboard_rs->recalculate_all;
|
||||
}
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
Usage: APPLICATION recalc_leaderboards
|
||||
|
||||
Recalculates ALL leaderboards.
|
||||
|
||||
=cut
|
||||
|
||||
1;
|
Reference in a new issue