Currently, many loggings go missing or get logged out of order - if the score up/down buttons are pressed in rapid succession.
If they arrive out of order, then they would restore the wrong score - if the bout is still incomplete at the time of the restoration.
It will be wrong because the restoration takes the latest-logged result to be the latest, i.e. current result.
It is not a problem for any completed bout - the "End the Bout" button tends not to be pressed rapidly after the last hit is recorded, and the record, including scores, is re-written.
One option - record a sequence number each time a hit is recorded, and verify that the hit being restored has the highest sequence number. This means that the format of the hit-recording array needs to be altered.
Currently it is stored as
// Bout 1
currBout=1; boutStartTimes[1] = '2015-10-12T07:47:58.401Z';
currFencer1 = 1; currFencer2 = 2;boutStarted[1][2] = true ; boutStarted[2][1] = true ;
boutScores[1][2] = 3; boutScores[2][1] = 0;
Make the boutScores[][] into boutScores[currFencer1][currFencer2][hitSequence] ?
And increment the hitSequence each time a hit is recorded - OR a hit is corrected - by the referee.
How would it work out on the restoration? To be continued...
No comments:
Post a Comment