jquery-bracket icon indicating copy to clipboard operation
jquery-bracket copied to clipboard

How do I know I've already finished a tournament?

Open LuisBarcenas14 opened this issue 8 years ago • 2 comments

I working with your api for my scholar project and I do not find the way to close automatically a tourney

LuisBarcenas14 avatar Jun 07 '17 03:06 LuisBarcenas14

Unfortunately I don't think there is any straightforward way of knowing that. Depending on the settings and number of participants, the number of matches can change. Quite a nasty hack would be to see if the DOM has the HTML element indicating the winner (the "1st" arrow next to the result box).

You could fork the library and add your own way for indicating the completeness too.

teijo avatar Jun 07 '17 14:06 teijo

Hi, Maybe it's a bit late for your project, but I found a way to achieve this that I can share :

1/ In jquery.bracket.min.js, I forced BYE items (empty) to have a specific class: Add this code just before : return void t.append("BYE"); $(t).parent().addClass("byeempty");

2/ In my saveFN function, I add a test fired after every edit that check if all steps are completed, if yes, it do an action (in my case, show a button that allow to record results) var numItems = $('.team').not('.byeempty').not('.lose').not('.win').length; if(numItems==0) $('#saveResults').show(); else $('#saveResults').hide();

Thanks to @teijo for this nice project ! I didn't found the JS unminified, if this is public and you accept to share it, it would be wonderfull!!! :)

noiwid avatar Mar 29 '18 11:03 noiwid