jethro-pmm
jethro-pmm copied to clipboard
Auto-save attendance
Currently when entering attendance you have to click the save button at the bottom for anything to save to the server. If something goes wrong or you forget to submit, all your data entry is lost. This could be overcome by saving each "A" or "P" button click to the server as it happens.
Yes please add this option! Thank You!
Like the idea, but it sounds like this would add a lot of http calls. Might it be better to put things in a queue, and then either do the AJAX request either on a timer or when enough items are in the queue? Maybe not a problem if we can keep the connection alive. But then we''d still be doing a whole heap of php and mysql calls very quickly.... Just my 2c worth!
Plan for how to do it:
- When you open the edit-attendance page, it acquires the lock for attendance
- When you click some A or P buttons, these changes are added to a queue (and perhaps a spinning-wheel icon is shown next to them signifies saving in progress)
- every 5 seconds, if the queue is not empty, changes are submitted via AJAX
- When AJAX request is received, the lock is re-acquired (lock timeout resets)
- When AJAX request returns successfully, the browser shows a subtle "changes saved" message and the relevant spinning-wheel icons are cleared
- If nothing is clicked for LOCK_LENGTH minutes, an alert box asks "Do you want to continue recording attendance?". If the user clicks "Yes", it tries to re-aquire the lock so recording can continue.
- The "save" button at the bottom will be renamed to "done", and will submit a form which releases the lock