qcod / laravel-gamify

Gamify your Laravel app with Reputation Points & Achievements Badges support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leaderboard Position

mydnic opened this issue · comments

Hello!

I was wondering what would be the best approach here to get the "ranking position" of a User A in comparison to all other users.

The goal would be to display #3 next to the user's name if he's 3rd in his total points.

User X has 1 point
User Y has 1000 points
User Z has 900 Point
User A has 800 Points -> he's in 3rd position in the global users ranking.

My first thought would be to run a daily cron job to aggregate each user's points in a new column on the users table. Then query all users ordered by this column ?

Thanks in advance