thewca / wca-live

Platform for running WCA competitions and sharing live results with the world
https://live.worldcubeassociation.org
70 stars 23 forks source link

New feature; It would be great to also have API to submit a full scorecard #202

Closed Citaborg closed 9 months ago

Citaborg commented 9 months ago

When entering result from external device - in our case a scanner, we usually have all the attempts ready.

Can we have an endpoint accepting a list of AttemptResult?

Alternatively a new struct normalizing the event, competitor, etc, and a simpler dictionary for the attempts.

{
  "competitionWcaId" : "Comp123",
  "eventId" : "333",
  "registrantId" : 1,
  "roundNumber":1,
  "attempts": [{
      "attemptNumber" : 1,
      "attemptResult":1234
  },{
      "attemptNumber" : 2,
      "attemptResult":5678
  }]
}
jonatanklosko commented 9 months ago

I think we can even generalize this such that the endpoint accepts attempts for multiple competitors, so that you can submit multiple scorecards at a time (similarly to how WCA Live client has optional batch mode).

Though in the scanner case, you can just submit each request asynchronously, so that it doesn't block the user from placing another scorecard, or is there a reason you need to wait?

Citaborg commented 9 months ago

No, we have no reason to wait for each call to finish - so this is just to have a more convenient way of submitting. We were using Azure Document Intelligence to read the handwriting on the scorecards, and used a batched job for that - so we would actually get up to 30 scorecard analyzed at the same time. In that way your even more generalized way - to submit several scorecards at once would be sweet :-)

jonatanklosko commented 9 months ago

@Citaborg see this section for the new endpoint :)

Citaborg commented 9 months ago

Great work. Thank you :)