fix broadcast bracket

sync_v2
Raz 6 months ago
parent 054aa07b50
commit 94c3429bd8
  1. 15
      tournaments/models/tournament.py
  2. 18
      tournaments/static/tournaments/js/tournament_bracket.js

@ -1474,10 +1474,17 @@ class Tournament(BaseModel):
main_rounds_reversed = []
# Get main bracket rounds (excluding children/ranking matches)
main_rounds = self.rounds.filter(
parent=parent_round,
group_stage_loser_bracket=False
).order_by('-index')
if double_butterfly_mode:
main_rounds = self.rounds.filter(
parent=parent_round,
group_stage_loser_bracket=False,
index__lte=3
).order_by('-index')
else:
main_rounds = self.rounds.filter(
parent=parent_round,
group_stage_loser_bracket=False
).order_by('-index')
count = main_rounds.count()
if display_loser_final and count > 1:

@ -105,7 +105,7 @@ function renderBracket(options) {
// Create matches container
const matchesContainer = document.createElement("div");
matchesContainer.className = "matches-container";
if (doubleButterflyMode == true) {
if (doubleButterflyMode == true && roundCount > 3) {
if (roundIndex >= finalRoundIndex - 1) {
matchesContainer.style.transform = `translateX(-50%)`;
if (roundIndex >= finalRoundIndex + 2) {
@ -146,15 +146,19 @@ function renderBracket(options) {
}
if (roundIndex === 0) {
nextMatchDistance = 0;
if (doubleButterflyMode == false) {
nextMatchDistance = 0;
} else {
if (realRoundIndex > 1) {
nextMatchDistance = 0;
}
}
if (roundCount > 1) {
const nextMatchesCount = rounds[roundIndex + 1].length;
if (currentMatchesCount == nextMatchesCount && roundCount > 2) {
nextMatchDistance = 0;
}
} else {
nextMatchDistance = 0;
}
top = matchIndex * (matchHeight + matchSpacing) * minimumMatchDistance;
@ -163,7 +167,11 @@ function renderBracket(options) {
top = top + (matchHeight + matchSpacing) / 2;
}
} else if (roundIndex === roundCount - 1 && doubleButterflyMode == true) {
nextMatchDistance = 0;
if (roundCount > 3) {
nextMatchDistance = 0;
} else {
nextMatchDistance = nextMatchDistance / 2;
}
} else if (roundIndex == finalRoundIndex && realRoundIndex == 0) {
//realRoundIndex 0 means final's round
const values = Object.values(matchPositions[roundIndex - 1]);

Loading…
Cancel
Save