Added code to leaderboard web app API

This commit is contained in:
Finn 2017-11-10 17:07:41 +00:00
parent c4681ffc3a
commit 049b4836c5
2 changed files with 2 additions and 1 deletions

View file

@ -148,6 +148,7 @@ sub startup {
$api->post('/user-history')->to('api-user#post_user_history');
$api->post('/stats')->to('api-stats#post_index');
$api->post('/stats/leaderboard')->to('api-stats#post_leaderboards');
$api->post('/stats/leaderboard/paged')->to('api-stats#post_leaderboards_paged');
$api->post('/outgoing-transactions')->to('api-transactions#post_transaction_list_purchases');

View file

@ -129,7 +129,6 @@ sub post_leaderboards_paged {
if ( !defined $validation->param('page') || $validation->param('page') < 1 ) {
my $user_position = $today_board->values->find({ entity_id => $c->stash->{api_user}->entity->id });
if { $user_position > 10 ) {
my $math1;
int($user_position / 10) + 1 = $page;
}
}
@ -171,6 +170,7 @@ sub post_leaderboards_paged {
leaderboard => [ @leaderboard_array ],
user_position => defined $current_user_position ? $current_user_position->{position} : 0,
page => $validation->param('page') || $page,
page_no => $today_values->pager->total_entries,
});
}