fixed snippets if no values to get
This commit is contained in:
parent
59dd053b45
commit
8e1e9b2ec2
1 changed files with 4 additions and 3 deletions
|
@ -16,9 +16,10 @@ sub index {
|
||||||
|
|
||||||
my $leaderboard_rs = $c->schema->resultset('Leaderboard');
|
my $leaderboard_rs = $c->schema->resultset('Leaderboard');
|
||||||
my $monthly_board = $leaderboard_rs->get_latest( 'monthly_total' );
|
my $monthly_board = $leaderboard_rs->get_latest( 'monthly_total' );
|
||||||
|
if (defined $monthly_board) {
|
||||||
my $monthly_values = $monthly_board->values;
|
my $monthly_values = $monthly_board->values;
|
||||||
$data->{ user_position } = $monthly_values ? $monthly_values->find({ entity_id => $entity->id })->position : 0;
|
$data->{ user_position } = $monthly_values ? $monthly_values->find({ entity_id => $entity->id })->position : 0;
|
||||||
|
}
|
||||||
return $c->render(
|
return $c->render(
|
||||||
json => {
|
json => {
|
||||||
success => Mojo::JSON->true,
|
success => Mojo::JSON->true,
|
||||||
|
|
Reference in a new issue