Skip to content

Commit 2270c2c

Browse files
committed
update to leaderboard generation
1 parent 1416f23 commit 2270c2c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sql/2_generate_leaderboard.sql

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,23 @@ from
2929
-- inner join to ensure both user and submission record exists
3030
inner join user u
3131
on s.user_id = u.user_id
32-
-- these 2 joins bring in the last game_player for a submission
32+
-- these 3 joins bring in the last game_player and game for a submission
3333
left outer join (select submission_id, max(game_id) as game_id
3434
from game_player
3535
group by submission_id) gpmax
3636
on gpmax.submission_id = s.submission_id
3737
left outer join game_player gp
3838
on gp.submission_id = gpmax.submission_id
39-
and gp.game_id = gpmax.game_id,
39+
and gp.game_id = gpmax.game_id
40+
left outer join game g
41+
on g.game_id = gpmax.game_ID,
4042
(select @count1 := 0) c1,
4143
(select @count2 := 0) c2
4244
where s.latest = 1
4345
-- ghost requirements
4446
or (
4547
-- can only be 48 hours old
46-
s.timestamp > timestampadd(hour, -400, current_timestamp)
48+
g.timestamp > timestampadd(hour, -48, current_timestamp)
4749
-- must have smaller sigma (more confident than current)
4850
and s.sigma = (select min(sigma)
4951
from submission s2

0 commit comments

Comments
 (0)