fixed snippets if no values to get
This commit is contained in:
parent
5049fa9eed
commit
536ab21551
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' );
|
||||||
my $monthly_values = $monthly_board->values;
|
if (defined $monthly_board) {
|
||||||
$data->{ user_position } = $monthly_values ? $monthly_values->find({ entity_id => $entity->id })->position : 0;
|
my $monthly_values = $monthly_board->values;
|
||||||
|
$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