Forum Academy Marketplace Showcase Pricing Features

Filtering by date range for points system

Hey team!

I’m creating a leaderboard on a social site where people get points for completing certain tasks. Currently, I have the points on the User data type, and when the user completes a task, the number of points is just added to that field.

It’s all working beautifully, for total points scored. Unfortunately I want to be able to break it up by leaders for the month, and leaders for all-time.

Will this require a completely new data type setup? I can’t quite grasp how to do it at the moment!

Thanks for any help.

Hi there, @nickhutton13… there are a number ways you can do what you have described, but using a new data type isn’t the way that immediately comes to mind for me.

The first thing that comes to my mind are the tasks. I assume a task has a number of points associated with it, and you must be tracking when a particular task has been completed by a particular user, right? If so, you may already have access to a user’s all-time points and points in the current month through the completion of tasks and the associated completion dates.

Another thing that comes to mind is to have three fields on the User data type… something like points -total , points - current month, and date of last points. You would keep saving the total points like you do now, you would also save the points to the points - current month field, and you would record the date when the last points were saved. You would then use the date field to zero out a user’s points - current month field when the current month is not equal to the date in the field.

It goes without saying that tracking the points for the current month the way I have described above doesn’t give you any history of leaders from month to month. If you need something like that, then maybe a new data type is the way to go or maybe you can get at that information via the completed tasks as I previously mentioned.

Anyway, hope this helps, even if it’s just food for thought.

Best…
Mike

1 Like

Hey @mikeloc, thanks for the response.

And I think your new data type on the user to “points - current month” is perfect. I guess it’s just a tiny bit of work each month to change it to a new data type, but I reckon I can spare the 10 minutes a month!

No need for historical month winners either, so that works nicely.

Cheers Mike :slight_smile:

1 Like