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

match game count in a double-elimination bracket with BYE #184

Open
bilmakovskiyruslan opened this issue Oct 12, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@bilmakovskiyruslan
Copy link

bilmakovskiyruslan commented Oct 12, 2023

In case I want to set up different best-of settings for each round.
Steps:

  1. create bracket
  2. set matchSetupSettings
  3. update.seeding
    const manager = new BracketsManager(new InMemoryDatabase());
    const tournamentId = 0;
    const name = tournament.name;
    const type = 'double_elimination';
    const settings: StageSettings = { grandFinal: 'simple' };
    const seeding = ['1', '2', '3', null];
    await manager.create({ name, tournamentId, type, settings, seeding });
  
    const config = await manager.export();
    
    for await (const data of config.round) {
      await manager.update.matchChildCount('round', data.id, 1);
    }

    await manager.update.seeding(tournamentId, seeding);

    await manager.update.matchGame({
      id: 1,
      opponent1: { score: 1, id: null, result: 'loss' },
      opponent2: { score: 0, id: null, result: 'win' },
    });
    
    return await manager.export();

Expected result:
the loser from the first round moved to the second round (lower bracket)

Actual Result:
the loser from the first round sticks in the first round

Is it possible to move a user from the lower bracket to the next round automatically (if no opponent)?

image
@bilmakovskiyruslan bilmakovskiyruslan changed the title What is the correct way to update the match game count in a double-elimination bracket? match game count in a double-elimination bracket with BYE? Oct 12, 2023
@bilmakovskiyruslan bilmakovskiyruslan changed the title match game count in a double-elimination bracket with BYE? match game count in a double-elimination bracket with BYE Oct 12, 2023
@Drarig29
Copy link
Owner

Hey! Really nice UI!

Indeed I would expect that the loser goes into loser bracket round 2. This is a bug.

I'll fix it soon. Do you confirm you can manually complete the match in loser bracket round 1?

@Drarig29
Copy link
Owner

Drarig29 commented Oct 14, 2023

@bilmakovskiyruslan I can reproduce your issue, and I found a workaround that you can use for now.

    const manager = new BracketsManager(new InMemoryDatabase());
    const tournamentId = 0;
    const name = tournament.name;
    const type = 'double_elimination';
    const settings: StageSettings = { grandFinal: 'simple' };
    const seeding = ['1', '2', '3', null];
    await manager.create({ name, tournamentId, type, settings, seeding });
  
    const config = await manager.export();

    // Note: you don't need await here
-   for await (const data of config.round) {
+   for (const data of config.round) {

      // Note: do you know that you can use the `matchesChildCount` property in settings?
      // https://drarig29.github.io/brackets-docs/reference/model/interfaces/StageSettings.html#matchesChildCount
      await manager.update.matchChildCount('round', data.id, 1);
    }

    // You don't need this, and removing it should fix your issue.
-   await manager.update.seeding(tournamentId, seeding);

    await manager.update.matchGame({
      id: 1,
      opponent1: { score: 1, id: null, result: 'loss' },
      opponent2: { score: 0, id: null, result: 'win' },
    });
    
    return await manager.export();

@bilmakovskiyruslan
Copy link
Author

yes, without await manager.update.seeding(tournamentId, seeding) bracket progress works fine

@Drarig29 Drarig29 added the bug Something isn't working label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants