Improved leaderboard to remove previous items for recalculation
This commit is contained in:
parent
392d7f3a7a
commit
de0b58814e
1 changed files with 10 additions and 0 deletions
|
@ -47,6 +47,16 @@ sub run {
|
|||
return;
|
||||
}
|
||||
|
||||
my $dtf = $self->app->schema->storage->datetime_parser;
|
||||
my $existing_leaderboard_set = $leaderboard->search_related( 'sets', {
|
||||
date => $dtf->format_datetime( $datetime ),
|
||||
})->first;
|
||||
|
||||
if ( defined $existing_leaderboard_set ) {
|
||||
$existing_leaderboard_set->values->delete_all;
|
||||
$existing_leaderboard_set->delete;
|
||||
}
|
||||
|
||||
$leaderboard->create_new($datetime);
|
||||
|
||||
say "Done";
|
||||
|
|
Reference in a new issue