Showing posts with label Issues. Show all posts
Showing posts with label Issues. Show all posts

Sunday, 25 October 2015

The out-of-order bout scores problem

Due to timing issues, sometimes early hits from the bout arrive later than the later hits.

If these are simply appended to the list of scores, then the last score to be written to -status.js would be applied to a recovered bout.  And we want the last bout recorded, not the last bout received by PHP.

So - will freezing out the user input until the hit is recorded fix this? Yes.

Would freezing out user input for a second fix this?  Yes.

Would putting the scores into an array of scores, indexed by a score-input counter fix this?  Definitely.

So currently the scores are sent as the current score for [fencer1][fencer2] and [fencer2][fencer1]

Continue doing that, as at present.

When you send an updated score, send an increment number.

When you store the updated score (append it to -status.js) store them into an array of current bout's scores.

When restarting a recovered incomplete bout, find the current score that has the largest increment number, and use it.

If the current bout is unstarted, then no change from current code.

If the current bout is complete, no change  from current code.

So - send to getScores.php
getScores.php

change in -status.js format to include increment number