teijo / jquery-bracket

jQuery Bracket library for organizing single and double elimination tournaments
http://aropupu.fi/bracket/
MIT License
482 stars 253 forks source link

How to mark 'no result' from match? #145

Open kamilwylegala opened 6 years ago

kamilwylegala commented 6 years ago

Hello!

Is it possible to not provide result from match?

E.g. there is situation where both players get disqualified so no one move forward in bracket. It means opponent from other side of bracket will have BYE match.

Is it possible to indicate something like that using your plugin?

Thanks in advance!

teijo commented 6 years ago

It's not currently possible to flag forfeit/disqualification/default. Workaround is just give e.g. 1-0 win for the team that should proceed, which might or might not be a problem depending on your system.

kamilwylegala commented 6 years ago

I could contribute and create PR for that. Any idea how to approach this? How API should look like to support this?

E.g.

Results:
[
 [
   [1,0], //winner goes to final round alone
   [null, null] //no result available, both disqualified
 ],
 [
   [1, 0] // obvious winner?
 ]
]
teijo commented 6 years ago

null is problematic as that's currently indicating that the match is not yet played or the score is not input, i.e. that result should not affect the propagation of teams. This might require bringing a new more extensible score type into play, as currently only number | null is used.

For example something like this:

{
  type: "pass",
  reason: "Disqualified"
}

Current functionality should be possible to be represented too with this "object score" approach:

{
  type: "number",
  score: 2
}

Additionally there could be a custom type for user-defined scores (in this demo you could have custom 3-round score that would be calculated in way you'd define in a scoring function):

{
  type: "user",
  value: [2,3,0]
}

For best TypeScript utilization, there should be a common enumerated field in the score object for distinguishing the different variations, including the built-in types and the user-extensible type. In this case it's the type field.

Better support for something like this is actually being worked currently in a feature branch to have proper typing - using generics - for custom scores and team definitions (which already exists as a feature).

kamilwylegala commented 6 years ago

Thanks for detailed response.

Yes, it totally makes sense to have result object.

What is the progress in branch you mentioned? Can I support you somehow?

teijo commented 6 years ago

What is the progress in branch you mentioned? Can I support you somehow?

Merged the stuff to master now. The generics are not exposed from the library yet but used internally.

millhoff commented 6 years ago

See my solution (for wordpress) on https://github.com/teijo/jquery-bracket/issues/147

kamilwylegala commented 6 years ago

@millhoff

How does it relate?

Isn't your solution about different spacing in score boxes?

millhoff commented 6 years ago

It’s a bit more than that as I created a short code which does allow you to specify the result as e.g 6:3,6:4. Or 0:6,6:4,7:6. It will make sure that the winner is the one who wins the last set and it also deals with the possible 0 at the beginning.

But it is only for WordPress and so far it has no DB or other features.

Cheers

Thorsten

Sent from my iPad

On 26 May 2018, at 14:05, Kamil Wylegala notifications@github.com wrote:

@millhoff

How does it relate?

Isn't your solution about different spacing in score boxes?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Slasher154 commented 6 years ago

Hi, I'm also facing the same situation where both competitors did not appear for the match and got disqualified. If possible, I don't want to randomly select either one to be winner. Is there any solution or workaround for this case?