I have some functionality in my webapp that locks out users from certain behavior for a set amount of time (e.g., they have to wait 10 minutes before they can update a level).
My query looks like this:
SELECT date_last_updated FROM levels WHERE user_id = 123 AND date_last_updated > date_sub(now(), INTERVAL 10 MINUTE);`
Please note that
Currently, if a row is returned I know they're still in the lockout, so that's fine for a boolean result. But just a single column row of the remaining time, in minutes as an integer would be better. That is where anything > 0 indicates both lockout is in effect, and how much time is left.
How would I do this?