This is a tale about a disastrous auto-save feature that I baked in a project that I've worked on. Make sure that your auto-save are done "automatically."
We're talking about the tabulation system that I built almost a year ago. It is used to automatically compute the final scores from the criteria percentages and the scores input by the judges. It looks like this:
What'll Happen?
It has input box for the scores for each criteria for each talent, and the scores are sent asynchronously as soon as an input box loses focus.
For example, the judge enters a score for Talent 1 - Criteria A. The input box for Talent 1 - Criteria A gains focus as the judge types the score. When the judge moves to enter a score to Talent 1 - Criteria B, the input box for it gains focus and the input box for Talent 1 - Criteria A loses focus, then it sends the value to the server to update the table for Talent 1 - Criteria A.
What's Happening?
Shown in the animation above is the rough simulation of the judge inputting the scores. Blue boxes indicate that the input box is in focus. Green boxes indicate that the value is sent to the server and is acknowledged and saved to the database. See the problem there?
The last input box never loses focus as there is nothing left for the focus to move. And when an input box doesn't lose focus, the event will not trigger, and the value will not be sent to the server.
To make things worse, the value for each criteria for each talent is set to zero by default thus making it possible to compute the average even if the last score was not sent.
What Happened?
Since the server never got the last input box value, the computed scores were inaccurate and we announced a wrong winner.
It was a disaster but it has been resolved now.
What Should Happen?
There's a lot that should happen instead but was overlooked due to the rushed 2-day development period and lack of proper testing.
- THERE SHOULD BE A SAVE BUTTON INSTEAD.
- Saving a score should be also triggered when the user stops typing.
- And do proper testing.