Leaderboard Top 50 (per month)

What about quering the >50 (monthly) leaderboard members? That’s better than selecting overall cheers because it push the permanent contributions.

That badge should enable an specific event in our instance :slight_smile:

2 Likes

Perhaps something like this would do the trick?

SELECT user_id, CURRENT_TIMESTAMP AS granted_at, SUM(score) AS score
FROM gamification_scores
WHERE date >= CURRENT_DATE - INTERVAL '1 MONTH'
  AND user_id > 0
GROUP BY 1
ORDER BY score DESC
LIMIT 50
2 Likes