forcescore command cannot submit to a closed match
Closed this issue · 2 comments
The host-facing forcescore
command cannot use the same solution as #136 because it is supposed to be able to edit a closed match. However, there is a design issue regarding finding a closed match to edit. forcescore
is supposed to be able to override the score for a closed match in case the players report the wrong score. The challonge endpoint does not allow filtering matches by round, and we've so far used "match is open" as synecdoche for "match is in current round". We need to investigate if there's a way to confirm whether or not a closed match is in the current round. Even if the output is sorted by round, if the user a host tries to force the score for has the natural bye, taking their last match will in the previous round.
Thinking on this further, if the output is sorted by round, that might be enough, since we can check if the player being queried has the natural bye. If the queried player does have the natural bye, we would simply throw a UserError
and say their score can't be edited, since they don't have one for this round. The only issue remaining, in this case, would be that if the final score is submitted the next round is automatically generated on challonge before a host can intervene.
After checking with a CURL, matches do have a round
field. This could solve the issue handily. I don't think we need to reintroduce round statefulness to the database, we can simply get the current round from Challonge by getting the round of any open match. For single elimination matches in different rounds can be open at the same time. In this case, I think it would be correct to get the earliest such round and say that matches in future rounds shouldn't be played yet. The results do seem to be sorted by age, so getting the first open match should achieve this.