When orders are ready players can finalize. If they then refresh the page after the turn has cycled, this call to finalize is resent. I suggest that a hidden field "phase" is added to the form, with the phase as it's value. Then, a simple check at the top of the script can compare this to the game's current phase. If they are different rather than processing any updates or finalizations the script can ignore them and move on to outputting the page. Oh, and it would be nice to output a gentle warning at the top of the page to say this has happened, especially if players were trying to update their orders but the game processed before they finished submitting them, as otherwise they might wonder why what they ordered didn't occur. This could be thought of as a bug, but the site is correct, it's just another safeguard for user errors.
|