fix dates issues

tz
Raz 1 year ago
parent 917c3c7874
commit a4e98bcdb9
  1. 15
      tournaments/models/tournament.py
  2. 13
      tournaments/static/tournaments/css/broadcast.css
  3. 2
      tournaments/templates/tournaments/broadcast/broadcasted_auto.html

@ -444,7 +444,7 @@ class Tournament(models.Model):
# if now is before the first match, we want to show the summons + group stage or first matches # if now is before the first match, we want to show the summons + group stage or first matches
# change timezone to datetime to avoid the bug RuntimeWarning: DateTimeField Tournament.start_date received a naive datetime (2024-05-16 00:00:00) while time zone support is active. # change timezone to datetime to avoid the bug RuntimeWarning: DateTimeField Tournament.start_date received a naive datetime (2024-05-16 00:00:00) while time zone support is active.
if datetime.now().date() < self.start_date.date(): if timezone.now() < self.start_date:
team_summons_dicts = [summon.to_dict() for summon in self.team_summons()] team_summons_dicts = [summon.to_dict() for summon in self.team_summons()]
if group_stages: if group_stages:
return { return {
@ -660,13 +660,20 @@ class Tournament(models.Model):
first_match_start_date = self.first_match_start_date(bracket_matches) first_match_start_date = self.first_match_start_date(bracket_matches)
if first_match_start_date is None: if first_match_start_date is None:
return datetime.now().date() >= self.start_date.date() return timezone.now() >= self.start_date
bracket_start_date = self.getEightAm(first_match_start_date) bracket_start_date = self.getEightAm(first_match_start_date)
if bracket_start_date < self.start_date: if bracket_start_date < self.start_date:
bracket_start_date = self.start_date bracket_start_date = self.start_date
if datetime.now().date() >= bracket_start_date.date(): group_stage_start_date = self.group_stage_start_date()
if group_stage_start_date is not None:
if bracket_start_date < group_stage_start_date:
return False
if timezone.now() >= bracket_start_date:
return True return True
return False return False
@ -685,7 +692,7 @@ class Tournament(models.Model):
return min(matches, key=lambda m: m.start_date).start_date return min(matches, key=lambda m: m.start_date).start_date
def getEightAm(self, date): def getEightAm(self, date):
return date.replace(hour=8, minute=0, second=0, microsecond=0) return date.replace(hour=8, minute=0, second=0, microsecond=0, tzinfo=date.tzinfo)
def supposedly_in_progress(self): def supposedly_in_progress(self):
end = self.start_date + timedelta(days=self.day_duration + 1) end = self.start_date + timedelta(days=self.day_duration + 1)

@ -22,6 +22,19 @@ body {
box-shadow: 0 0 0px 0px #fbead6; box-shadow: 0 0 0px 0px #fbead6;
} }
.headerbubble {
padding: 20px;
background-color: white;
border-radius: 24px;
box-shadow: 0 0 0px 0px #fbead6;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 120%; /* Allow bubble to take full width */
box-sizing: border-box; /* Include padding in the width calculation */
}
.bold { .bold {
font-family: "Montserrat-Bold"; font-family: "Montserrat-Bold";
} }

@ -98,7 +98,7 @@
<header> <header>
<div class="grid-x"> <div class="grid-x">
<div class="cell medium-6 large-6 topblock my-block"> <div class="cell medium-6 large-6 topblock my-block">
<div class="bubble"> <div class="left-content bubble">
<img <img
src="{% static 'tournaments/images/PadelClub_logo_512.png' %}" src="{% static 'tournaments/images/PadelClub_logo_512.png' %}"
class="logo inline" class="logo inline"

Loading…
Cancel
Save