Creating a Leaderboard page

Hi guys!

I’ve been building my first app now in Bubble, loving it so far!

One thing I can’t seem to figure out: I want to make a leaderboard page, based on the amount of ‘Likes’ people get on their posts in the last 90 days. Every ‘Like’ in stored in a separate data type, so it has a Creator, ‘Owner’, Creation Date, etc.

So, I want it to be that the leaderboard ranks the users by Likes in the last 90 days, very similar to this page: https://yootheme.com/support/leaderboard

I’ve been creating different types of repeating groups for days now, but no luck. Any help would be reeeeally appreciated! :slight_smile:

Cheers,
Robbert

I thought this would be straightforward but you’re right - it isn’t. At least not as far as I can see. Ordinarily, the easiest way to do a leaderboard is to have a likes_received number field on the User data type itself then anytime a user received a like, you would increment this value for the user.

Your requirement to count only likes received in the last 90 days makes this more interesting however, as you have to track the date the like was created, which means the Likes must be in a separate data type. You would then need to search for likes within 90 days, group them by user and sort by the count of likes (again in the last 90 days). Having explored this for a little while, I can’t see a way to do this in Bubble.

I found the following post by someone looking to do something similar. It appears they found a Blockspring block that can do this but couldn’t figure out how to send the data to Blockspring - maybe you can.

When a like is stored, update the like count (within 90 days) on the post and store the date of the oldest like (that is within 90 days). For ranking, retrieve all likes created within 90 days, then reference the post, update any like counts where the oldest like is greater than 90 days. Display the list when the like counts have been updated again (if needed).

Thanks for looking into this, Lousia and Scott! :smile:

It is indeed a bit trickier than I was hoping, haha! I will definitely look into Blockspring, haven’t used that service before.

@Scott I’m not sure I’m getting it… Do you think it would be possible, without using external services as Blockspring?

Yup. As I described it, it shouldn’t require any external services.

i have another doubt, maybe you guys can help me.

i have users with a number of followers, in the profile of each user i want to display the rank of the user compared to all other users, is this possible?

thank’s in advance!