diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 1753d03..f54e50b 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -840,7 +840,7 @@ class Tournament(models.Model): if self.end_date is not None: return is_build_and_not_empty - if timezone.now() >= timezone.localtime(self.start_date): + if timezone.now() >= self.local_start_date(): return is_build_and_not_empty minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1) return timezone.now() >= timezone.localtime(minimum_publish_date) @@ -850,7 +850,7 @@ class Tournament(models.Model): return self.has_team_registrations() if self.publish_teams: return self.has_team_registrations() - if timezone.now().date() >= self.start_date.date(): + if timezone.now() >= self.local_start_date(): return self.has_team_registrations() return False @@ -862,7 +862,7 @@ class Tournament(models.Model): return False if self.publish_summons: return self.has_summons() - if timezone.now() >= self.start_date: + if timezone.now() >= self.local_start_date(): return self.has_summons() return False @@ -876,7 +876,7 @@ class Tournament(models.Model): first_group_stage_start_date = self.group_stage_start_date() if first_group_stage_start_date is None: - return timezone.now() >= self.start_date + return timezone.now() >= self.local_start_date() else: return timezone.now() >= first_group_stage_start_date @@ -885,7 +885,8 @@ class Tournament(models.Model): if len(group_stages) == 0: return None - return min(group_stages, key=lambda gs: gs.start_date).start_date + timezone = self.timezone() + return min(group_stages, key=lambda gs: gs.start_date).start_date.astimezone(timezone) def display_matches(self): if self.end_date is not None: @@ -898,12 +899,12 @@ class Tournament(models.Model): first_match_start_date = self.first_match_start_date(bracket_matches) if first_match_start_date is None: - return timezone.now() >= self.start_date + return timezone.now() >= self.local_start_date() bracket_start_date = self.getEightAm(first_match_start_date) - if bracket_start_date < self.start_date: - bracket_start_date = self.start_date + if bracket_start_date < self.local_start_date(): + bracket_start_date = self.local_start_date() group_stage_start_date = self.group_stage_start_date() if group_stage_start_date is not None: @@ -926,8 +927,7 @@ class Tournament(models.Model): matches = [m for m in bracket_matches if m.start_date is not None] if len(matches) == 0: return None - - return min(matches, key=lambda m: m.start_date).start_date + return min(matches, key=lambda m: m.start_date).local_start_date() def getEightAm(self, date): return date.replace(hour=8, minute=0, second=0, microsecond=0, tzinfo=date.tzinfo) @@ -963,7 +963,7 @@ class Tournament(models.Model): if self.end_date is not None: return True - timezoned_datetime = timezone.localtime(self.start_date) + timezoned_datetime = self.local_start_date() end = timezoned_datetime + timedelta(days=self.day_duration + 1) now = timezone.now() return now >= end and self.is_build_and_not_empty() and self.nearly_over() diff --git a/tournaments/static/tournaments/css/broadcast.css b/tournaments/static/tournaments/css/broadcast.css index 5171712..2975558 100644 --- a/tournaments/static/tournaments/css/broadcast.css +++ b/tournaments/static/tournaments/css/broadcast.css @@ -31,7 +31,7 @@ body { flex: 1; display: flex; flex-direction: column; - min-height: 2.8em; /* This ensures minimum height for 2 lines */ + min-height: 3.2em; /* This ensures minimum height for 2 lines */ justify-content: center; overflow: hidden; } @@ -43,7 +43,6 @@ body { /* For single player teams */ .player.single-player .bold { - max-height: 2.8em; /* Adjust based on your needs */ line-height: 1.4em; overflow: hidden; position: relative; @@ -52,6 +51,7 @@ body { /* For two player teams */ .player.two-players .bold { + line-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index 80bcd9c..43d788a 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -327,7 +327,7 @@ tr { flex: 1; display: flex; flex-direction: column; - min-height: 2.8em; /* This ensures minimum height for 2 lines */ + min-height: 3.2em; /* This ensures minimum height for 2 lines */ justify-content: center; overflow: hidden; } @@ -339,7 +339,6 @@ tr { /* For single player teams */ .player.single-player .semibold { - max-height: 2.8em; /* Adjust based on your needs */ line-height: 1.4em; overflow: hidden; position: relative; @@ -348,6 +347,7 @@ tr { /* For two player teams */ .player.two-players .semibold { + line-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/tournaments/templates/tournaments/tournament_bracket.html b/tournaments/templates/tournaments/tournament_bracket.html index 53add55..c1453dd 100644 --- a/tournaments/templates/tournaments/tournament_bracket.html +++ b/tournaments/templates/tournaments/tournament_bracket.html @@ -59,12 +59,12 @@ function renderBracket() { const finalRoundIndex = (roundCount - 1) / 2; let nextMatchDistance = baseDistance; let minimumMatchDistance = 1; - if (rounds[0].length <= 2) { - minimumMatchDistance = 2 - nextMatchDistance = baseDistance * 2; - } rounds.forEach((roundMatches, roundIndex) => { + if (rounds[0].length <= 2) { + minimumMatchDistance = 2 + nextMatchDistance = baseDistance * 2; + } const roundDiv = document.createElement('div'); roundDiv.className = 'butterfly-round'; roundDiv.style.setProperty('--match-width', `${365}px`); @@ -172,7 +172,7 @@ function renderBracket() { } } - if (roundIndex >= finalRoundIndex - 1) { + if (roundIndex >= finalRoundIndex - 2) { if (roundCount > 5) { if (roundIndex == finalRoundIndex - 1) { matchDiv.classList.add('inward'); @@ -180,14 +180,14 @@ function renderBracket() { if (roundIndex == finalRoundIndex + 1) { matchDiv.classList.add('outward'); } + if (roundIndex === finalRoundIndex - 2 || roundIndex === finalRoundIndex + 2) { + nextMatchDistance = nextMatchDistance - baseDistance; + } } } - if (roundIndex === finalRoundIndex - 2 || roundIndex === finalRoundIndex + 2) { - nextMatchDistance = nextMatchDistance - baseDistance; - } - else if (roundIndex == finalRoundIndex - 1 || roundIndex == finalRoundIndex + 1) { + if (roundIndex == finalRoundIndex - 1 || roundIndex == finalRoundIndex + 1) { nextMatchDistance = baseDistance; }