Drarig29 / brackets-manager.js

A simple library to manage tournament brackets (round-robin, single elimination, double elimination).
https://drarig29.github.io/brackets-docs
MIT License
245 stars 38 forks source link

Feature Request: Allow Final match to be a draw #160

Closed GrimLothar closed 1 year ago

GrimLothar commented 1 year ago

Although it's definitely an edge case, we are seeing the possibility of a final match in an elimination tournament to have a no-show on both participants. After some thought, we figure that the best resolution in this case, would be for them both to share the 1st place.

The match would of course would have no winners, so I tried setting the match as a draw. Good news is that it allowed me to do it. Bad news is that the Brackets UI is not showing the match as finished. It's still showing it with the default dashes:

Screen Shot 2023-01-11 at 4 47 28 PM

Second bad news is that when I try to get the final standings, for some reason it's just removing one of the final participants from the rank:

  { id: 24, name: '37oe...gepS', rank: 1 },
  { id: 1, name: 'Lothar', rank: 2 },
  { id: 6, name: 'LotharLurker', rank: 2 }

You can reference the above image as well for the full list of participants. It removed the Ayrious2 participant.

Would it be too hard to allow for this scenario to happen? And if you don't have the time to support it, do you mind sharing some pointers on what would need to be changed and I can try to make a PR myself?

Thanks!

Drarig29 commented 1 year ago

Hey! Sorry for the delay.

The match would of course have no winners, so I tried setting the match as a draw. Good news is that it allowed me to do it.

The lib is actually ignoring the result: "draw" value when you use manager.update.match(). It's not "allowing you to do it", it's just doing nothing silently. If you look at the JSON, the final match will still be running ("status": 2), without any result. So the viewer behaves correctly.


Second bad news is that when I try to get the final standings, for some reason it's just removing one of the final participants from the rank

That's weird because with my snippet, the lib throws a "Participant not found." error, since the final match doesn't have a winner. I'll add a better error message for this.


Would it be too hard to allow for this scenario to happen?

I won't even try to evaluate the difficulty for this, because I simply won't let this happen and won't accept a PR for it, I'm sorry. This is more than an "edge case": it's an invalid case in this format of tournament.

The [single elimination format] is less suited to games where draws are frequent. In chess, each fixture in a single-elimination tournament must be played over multiple matches, because draws are common, and because white has an advantage over black. In association football, games ending in a draw may be settled in extra time and eventually by a penalty shootout or by replaying the fixture. (Source: Wikipedia)

The only update I would be willing to do to the lib is to throw an error message when trying to set a draw as a result in an elimination tournament (single and double elimination).

As you said this is an edge case for you, I'll let you support this on your side. If you really want to display this case with the viewer, I suggest you override the result with "opponent1": {"result": "loss"}, "opponent2": {"result": "loss"}:

image

(This works because the viewer doesn't have any "tournament logic", it will simply display what you give to it.)

Drarig29 commented 1 year ago

All online tournament management tools I know do not support this case either.

Toornament

image

Challonge

image

GrimLothar commented 1 year ago

Thank you as always for your detailed responses! I fully understand your decision to not support this scenario. I agree it's super edge case. Will figure out what to do with it when/if it happens. Thanks!