Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TBD participants in seeding #59

Closed
Drarig29 opened this issue Feb 13, 2021 · 3 comments
Closed

Support TBD participants in seeding #59

Drarig29 opened this issue Feb 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@Drarig29
Copy link
Owner

Drarig29 commented Feb 13, 2021

Currently, it's not possible to set a seeding with missing participants in a temporary way. Meaning to let them be "to be determined".

Maybe only update.seeding() should support this though. Passing a seeding to the create() method is really just for testing...

So the preferred way would be to create() a stage without a seeding - just a size - and then use update.seeding().


Related to #58


Edit:

See #59 (comment)

@Drarig29 Drarig29 added the enhancement New feature or request label Feb 17, 2021
@andrerivas
Copy link

andrerivas commented Oct 21, 2021

Update a few days later: This is actually way more complicated to hack in a way that supports all the various options! I eventually got it working, but it was a mess. What's written below is not the full solution at all, and I don't even recommend dealing with what I did, so never mind! Upvote for official support in the libraries.

I implemented a hacky solution to this that seems to work for now. I have added an attribute called registering to the top-level bracket data object. I also have a function I call whenever I retrieve the bracket data which, depending on the registering flag, will "translate" the matches to either show all the BYEs or show all the seeds. I use this to replace the match object. It does require that I save another array of "original_matches" when the stage is created.

Visually, it seems to work fine and lets the bracket viewer show all the available seeds in each match while players eventually register (rather than just a bunch of BYEs). When I'm ready to end registration, I flip registering to false and then the viewer renders any empty spots as BYEs.

    function repopulateMatchSeeds(bracketData) {

        if (bracketData.registering == true) {
            bracketData.match = bracketData.match.map( (match) => {
                if (match.opponent1 == null) match.opponent1 = bracketData.original_matches[match.id].opponent1;
                if (match.opponent2 == null) match.opponent2 = bracketData.original_matches[match.id].opponent2;
                return match;
            });
        } else { // no more registrations
            bracketData.match = bracketData.match.map( (match) => {
                if (match.opponent1.id == null) match.opponent1 = null;
                if (match.opponent2.id == null) match.opponent2 = null;
                return match;
            });
        }
        
        return bracketData.match;
    }

image

@Drarig29
Copy link
Owner Author

Maybe only update.seeding() should support this though.

Actually, this function already supports TBD participants, and only supports them: BYE aren't supported by it.

// In this context, a `null` value is not a BYE, but a TDB (to be determined)
// because we consider the tournament might have been started.
// If it's not and you prefer BYEs, just recreate the tournament.

@Drarig29
Copy link
Owner Author

So, let's say that if people want to set BYE participants, they'll need to use manager.create() with null values.

And if they want to set TBD participants, they'll need to use manager.update.seeding() with null values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants