Credit the elapsed time during a break if the user closed the .cards session / site
Right now the client communicates with the server in a 1 minute interval to credit the user for learning his workload. In this case the server increments the elapsed time by 1 if everything is OK.
Some users tend to close the site once a break starts, in which case the client won't communicate with the server any longer and thus the timer will be only incremented by 1, no matter for how much time has passed.
In this case the server should save the amount of elapsed minutes <= the max of what's allowed during the active break and switch to the "Continue learning? prompt" state if enough time passed.
This check needs to happen before the client restores the timer progress and only if the "break" state is active.
as a reminder there are following states that get saved on the server:
- No Break is active
- User gets a prompt to switch to break mode
- Break is active
- User gets a prompt to switch to work mode