match game count in a double-elimination bracket with BYE
bilmakovskiyruslan opened this issue · 3 comments
In case I want to set up different best-of settings for each round.
Steps:
- create bracket
- set matchSetupSettings
- 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](https://private-user-images.githubusercontent.com/73469420/274709248-95c693cb-86f2-4069-8715-e65cfed6aed8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzQwMTE4MDIsIm5iZiI6MTczNDAxMTUwMiwicGF0aCI6Ii83MzQ2OTQyMC8yNzQ3MDkyNDgtOTVjNjkzY2ItODZmMi00MDY5LTg3MTUtZTY1Y2ZlZDZhZWQ4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjEyVDEzNTE0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY0MjI1ZTg0YmU0NzY4M2Y1MDc3ZTZmZTcyNmE2OTVmZjU5YTFmYjc4ZWJkZDM2NDg4M2FmM2I2NmEwNGE1MjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.FQ10r0eochFrsAm5kg6jbDcdg_z2Hj6uMn8CobEU_Dc)
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?
@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();
yes, without await manager.update.seeding(tournamentId, seeding)
bracket progress works fine