Skip to content

Commit d8e3cec

Browse files
committed
adicao rodada 5
1 parent 2c6ff72 commit d8e3cec

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/services/dataService.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,19 @@ const generateStructure = (count: number): Round[] => {
3333
const matchesPerRound = Math.ceil(count / 2);
3434

3535
// Dynamic Swiss Rounds Count
36-
// 7-10 teams: 4 Rounds
37-
// 11+ teams: 5 Rounds
38-
const swissRoundsCount = count <= 10 ? 4 : 5;
36+
let swissRoundsCount = 5;
37+
let hasTiebreaker = false;
38+
39+
if (count <= 9) {
40+
swissRoundsCount = 4;
41+
} else if (count === 10) {
42+
// 10 Teams: 4 Swiss Rounds + Tiebreaker Round
43+
swissRoundsCount = 4;
44+
hasTiebreaker = true;
45+
} else {
46+
// 11+ Teams: 5 Swiss Rounds
47+
swissRoundsCount = 5;
48+
}
3949

4050
for (let i = 1; i <= swissRoundsCount; i++) {
4151
rounds.push({
@@ -45,6 +55,15 @@ const generateStructure = (count: number): Round[] => {
4555
});
4656
}
4757

58+
// Tiebreaker Round (Specific for 10 teams or custom config)
59+
if (hasTiebreaker) {
60+
rounds.push({
61+
name: "Desempate",
62+
matches: createTBDMatches(2), // 2 slots for potential tiebreakers
63+
toBeDetermined: true
64+
});
65+
}
66+
4867
// Dynamic Playoffs
4968
if (count <= 9) {
5069
// Top 6 Format (Byes for Top 2)

0 commit comments

Comments
 (0)