Merge pull request #14 from Pear-Trading/finn/frontpagestats
Merge frontpage rank into dev
This commit is contained in:
commit
e76025c44e
3 changed files with 61 additions and 0 deletions
|
@ -37,6 +37,10 @@ sub post_index {
|
||||||
my $global_sum = $global_rs->get_column('value')->sum;
|
my $global_sum = $global_rs->get_column('value')->sum;
|
||||||
my $global_count = $global_rs->count;
|
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 => {
|
return $c->render( json => {
|
||||||
success => Mojo::JSON->true,
|
success => Mojo::JSON->true,
|
||||||
today_sum => $today_sum || 0,
|
today_sum => $today_sum || 0,
|
||||||
|
@ -49,6 +53,7 @@ sub post_index {
|
||||||
user_count => $user_count,
|
user_count => $user_count,
|
||||||
global_sum => $global_sum || 0,
|
global_sum => $global_sum || 0,
|
||||||
global_count => $global_count,
|
global_count => $global_count,
|
||||||
|
user_position => defined $current_user_position ? $current_user_position->position : 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
54
make_leaderboards
Normal file
54
make_leaderboards
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-01
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-02
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-03
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-04
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-05
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-06
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-07
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-08
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-09
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-10
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-11
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-12
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-13
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-14
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-15
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-16
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-17
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-18
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-19
|
||||||
|
./script/pear-local_loop leaderboard -t daily_total -d 2017-07-20
|
||||||
|
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-01
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-02
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-03
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-04
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-05
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-06
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-07
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-08
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-09
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-10
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-11
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-12
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-13
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-14
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-15
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-16
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-17
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-18
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-19
|
||||||
|
./script/pear-local_loop leaderboard -t daily_count -d 2017-07-20
|
||||||
|
|
||||||
|
./script/pear-local_loop leaderboard -t weekly_count -d 2017-07-03
|
||||||
|
./script/pear-local_loop leaderboard -t weekly_count -d 2017-07-10
|
||||||
|
./script/pear-local_loop leaderboard -t weekly_total -d 2017-07-03
|
||||||
|
./script/pear-local_loop leaderboard -t weekly_total -d 2017-07-10
|
||||||
|
|
||||||
|
./script/pear-local_loop leaderboard -t monthly_total -d 2017-05-01
|
||||||
|
./script/pear-local_loop leaderboard -t monthly_total -d 2017-06-01
|
||||||
|
./script/pear-local_loop leaderboard -t monthly_count -d 2017-05-01
|
||||||
|
./script/pear-local_loop leaderboard -t monthly_count -d 2017-06-01
|
||||||
|
|
||||||
|
./script/pear-local_loop leaderboard -t all_time_total -d 2017-07-13
|
||||||
|
./script/pear-local_loop leaderboard -t all_time_count -d 2017-07-13
|
|
@ -44,6 +44,8 @@ my $session_key = $framework->login({
|
||||||
password => $user->{password},
|
password => $user->{password},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$t->app->schema->resultset('Leaderboard')->create_new( 'monthly_total', DateTime->now->truncate(to => 'month' )->subtract( months => 1) );
|
||||||
|
|
||||||
$t->post_ok('/api/stats' => json => { session_key => $session_key } )
|
$t->post_ok('/api/stats' => json => { session_key => $session_key } )
|
||||||
->status_is(200)
|
->status_is(200)
|
||||||
->json_is('/success', Mojo::JSON->true)
|
->json_is('/success', Mojo::JSON->true)
|
||||||
|
|
Reference in a new issue