I'm building a system which has notifications where if a user 'likes' something, the other user gets a notification to let them know and they gain points.
I have an actions
table where events are stored, and a flag to say whether it has been read (whether the notification has been read).
Problems arise when a user continuously likes/unlikes the same thing (as people like to do, to break stuff). I don't want to add and subtract every time from the other users points, and I don't want really want to log every event of like and unlike, so I need some form of buffer that waits a while to see whether the end result was an actual like - and then process the event and show the notification.
The likes themselves have timestamps, so I could do something around that, but I wondered whether there is a better way of storing this info into a 'buffer' table and then calculate the end result there? What is the most cost-effective method of doing this?