|
|
|
@ -840,7 +840,7 @@ class Tournament(models.Model): |
|
|
|
|
|
|
|
|
|
|
|
if self.end_date is not None: |
|
|
|
if self.end_date is not None: |
|
|
|
return is_build_and_not_empty |
|
|
|
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 |
|
|
|
return is_build_and_not_empty |
|
|
|
minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1) |
|
|
|
minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1) |
|
|
|
return timezone.now() >= timezone.localtime(minimum_publish_date) |
|
|
|
return timezone.now() >= timezone.localtime(minimum_publish_date) |
|
|
|
@ -850,7 +850,7 @@ class Tournament(models.Model): |
|
|
|
return self.has_team_registrations() |
|
|
|
return self.has_team_registrations() |
|
|
|
if self.publish_teams: |
|
|
|
if self.publish_teams: |
|
|
|
return self.has_team_registrations() |
|
|
|
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 self.has_team_registrations() |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
@ -862,7 +862,7 @@ class Tournament(models.Model): |
|
|
|
return False |
|
|
|
return False |
|
|
|
if self.publish_summons: |
|
|
|
if self.publish_summons: |
|
|
|
return self.has_summons() |
|
|
|
return self.has_summons() |
|
|
|
if timezone.now() >= self.start_date: |
|
|
|
if timezone.now() >= self.local_start_date(): |
|
|
|
return self.has_summons() |
|
|
|
return self.has_summons() |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
@ -876,7 +876,7 @@ class Tournament(models.Model): |
|
|
|
|
|
|
|
|
|
|
|
first_group_stage_start_date = self.group_stage_start_date() |
|
|
|
first_group_stage_start_date = self.group_stage_start_date() |
|
|
|
if first_group_stage_start_date is None: |
|
|
|
if first_group_stage_start_date is None: |
|
|
|
return timezone.now() >= self.start_date |
|
|
|
return timezone.now() >= self.local_start_date() |
|
|
|
else: |
|
|
|
else: |
|
|
|
return timezone.now() >= first_group_stage_start_date |
|
|
|
return timezone.now() >= first_group_stage_start_date |
|
|
|
|
|
|
|
|
|
|
|
@ -885,7 +885,8 @@ class Tournament(models.Model): |
|
|
|
if len(group_stages) == 0: |
|
|
|
if len(group_stages) == 0: |
|
|
|
return None |
|
|
|
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): |
|
|
|
def display_matches(self): |
|
|
|
if self.end_date is not None: |
|
|
|
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) |
|
|
|
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 timezone.now() >= self.start_date |
|
|
|
return timezone.now() >= self.local_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.local_start_date(): |
|
|
|
bracket_start_date = self.start_date |
|
|
|
bracket_start_date = self.local_start_date() |
|
|
|
|
|
|
|
|
|
|
|
group_stage_start_date = self.group_stage_start_date() |
|
|
|
group_stage_start_date = self.group_stage_start_date() |
|
|
|
if group_stage_start_date is not None: |
|
|
|
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] |
|
|
|
matches = [m for m in bracket_matches if m.start_date is not None] |
|
|
|
if len(matches) == 0: |
|
|
|
if len(matches) == 0: |
|
|
|
return None |
|
|
|
return None |
|
|
|
|
|
|
|
return min(matches, key=lambda m: m.start_date).local_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, tzinfo=date.tzinfo) |
|
|
|
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: |
|
|
|
if self.end_date is not None: |
|
|
|
return True |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
timezoned_datetime = timezone.localtime(self.start_date) |
|
|
|
timezoned_datetime = self.local_start_date() |
|
|
|
end = timezoned_datetime + timedelta(days=self.day_duration + 1) |
|
|
|
end = timezoned_datetime + timedelta(days=self.day_duration + 1) |
|
|
|
now = timezone.now() |
|
|
|
now = timezone.now() |
|
|
|
return now >= end and self.is_build_and_not_empty() and self.nearly_over() |
|
|
|
return now >= end and self.is_build_and_not_empty() and self.nearly_over() |
|
|
|
|