please help me with this :
The scenario:
building a system (Backend :Mysql , scripting lang : Javascript/ PHP)
where the user perform some actions in order to gain some points. let’s say 1 action = 1 point.
My problem : Now i want to limit users to gain atmax 5 points per day. Mean between the interval of 24 hours user can do those actions any number of times but the the points increments will top after reaching “5”
Please suggest me a efficient way of doing it. my DB is minimalistic and have only User details, points .
Now i need to add a timestamp column. No problem , But the problem how do i choose to update the time and when. very confused 🙁
One of the way you can achieve this is to keep track of the points total, points in a given day and the timestamp of the last point update. Then your logic would look like this:
Essentially, it will allow no more than 5 points in any calendar day. You need to be careful though if your system is to be used from multiple time zones, because in that case “today” means different things to different people. For example, it may be Tuesday 2am in London (i.e. the day changed), but it’s still Monday 6pm in San Francisco (i.e the day didn’t change)