Front page stat sending added

This commit is contained in:
Finn 2017-07-19 17:29:00 +01:00
parent 7010825707
commit 4f09483f59

View file

@ -37,6 +37,10 @@ sub post_index {
my $global_sum = $global_rs->get_column('value')->sum;
my $global_count = $global_rs->count;
my $leaderboard_rs = $c->schema->resultset('Leaderboard');
my $monthly_board = $leaderboard_rs->get_latest( 'monthly_total' );
my $current_user_position = $monthly_board->values->find({ user_id => $c->stash->{api_user}->id });
return $c->render( json => {
success => Mojo::JSON->true,
today_sum => $today_sum || 0,
@ -49,6 +53,7 @@ sub post_index {
user_count => $user_count,
global_sum => $global_sum || 0,
global_count => $global_count,
user_position => $current_user_position,
});
}