|
|
|
@ -215,7 +215,7 @@ class Tournament(models.Model): |
|
|
|
return "Annulé" |
|
|
|
return "Annulé" |
|
|
|
|
|
|
|
|
|
|
|
teams = self.teams(True) |
|
|
|
teams = self.teams(True) |
|
|
|
if self.supposedly_in_progress() or self.end_date is not None: |
|
|
|
if self.supposedly_in_progress() or self.end_date is not None or self.should_be_over(): |
|
|
|
teams = [t for t in teams if t.stage != "Attente"] |
|
|
|
teams = [t for t in teams if t.stage != "Attente"] |
|
|
|
if teams is not None and len(teams) > 0: |
|
|
|
if teams is not None and len(teams) > 0: |
|
|
|
word = "équipe" |
|
|
|
word = "équipe" |
|
|
|
@ -614,7 +614,7 @@ class Tournament(models.Model): |
|
|
|
matches = [] |
|
|
|
matches = [] |
|
|
|
group_stages = [] |
|
|
|
group_stages = [] |
|
|
|
|
|
|
|
|
|
|
|
if len(self.groupstage_set.all()) > 0 and self.no_bracket_match_has_started(): |
|
|
|
if self.groupstage_set.count() > 0 and self.no_bracket_match_has_started(): |
|
|
|
group_stages = [gs.live_group_stages() for gs in self.last_group_stage_step()] |
|
|
|
group_stages = [gs.live_group_stages() for gs in self.last_group_stage_step()] |
|
|
|
matches = self.broadcasted_group_stages_matches() |
|
|
|
matches = self.broadcasted_group_stages_matches() |
|
|
|
first_round = self.first_round() |
|
|
|
first_round = self.first_round() |
|
|
|
@ -798,7 +798,7 @@ class Tournament(models.Model): |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
def has_team_registrations(self): |
|
|
|
def has_team_registrations(self): |
|
|
|
return len(self.teamregistration_set.all()) > 0 |
|
|
|
return self.teamregistration_set.count() > 0 |
|
|
|
|
|
|
|
|
|
|
|
def display_summons(self): |
|
|
|
def display_summons(self): |
|
|
|
if self.end_date is not None: |
|
|
|
if self.end_date is not None: |
|
|
|
@ -893,6 +893,14 @@ class Tournament(models.Model): |
|
|
|
|
|
|
|
|
|
|
|
return start <= now <= end |
|
|
|
return start <= now <= end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def should_be_over(self): |
|
|
|
|
|
|
|
if self.end_date is not None: |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timezoned_datetime = timezone.localtime(self.start_date) |
|
|
|
|
|
|
|
end = timezoned_datetime + timedelta(days=self.day_duration + 1) |
|
|
|
|
|
|
|
now = timezone.now() |
|
|
|
|
|
|
|
return now >= end and self.is_build_and_not_empty() |
|
|
|
|
|
|
|
|
|
|
|
def display_points_earned(self): |
|
|
|
def display_points_earned(self): |
|
|
|
return self.federal_level_category != FederalLevelCategory.UNLISTED and self.hide_points_earned is False |
|
|
|
return self.federal_level_category != FederalLevelCategory.UNLISTED and self.hide_points_earned is False |
|
|
|
@ -901,7 +909,7 @@ class Tournament(models.Model): |
|
|
|
return self.hide_teams_weight |
|
|
|
return self.hide_teams_weight |
|
|
|
|
|
|
|
|
|
|
|
def is_build_and_not_empty(self): |
|
|
|
def is_build_and_not_empty(self): |
|
|
|
return (len(self.groupstage_set.all()) > 0 or len(self.round_set.all()) > 0) and len(self.teamregistration_set.all()) >= 4 |
|
|
|
return self.groupstage_set.count() > 0 or self.round_set.count() > 0 and self.teamregistration_set.count() >= 4 |
|
|
|
|
|
|
|
|
|
|
|
def day_duration_formatted(self): |
|
|
|
def day_duration_formatted(self): |
|
|
|
return plural_format("jour", self.day_duration) |
|
|
|
return plural_format("jour", self.day_duration) |
|
|
|
@ -983,7 +991,7 @@ class Tournament(models.Model): |
|
|
|
|
|
|
|
|
|
|
|
# Check target team count and waiting list limit |
|
|
|
# Check target team count and waiting list limit |
|
|
|
if self.team_count is not None: |
|
|
|
if self.team_count is not None: |
|
|
|
current_team_count = len([tr for tr in self.teamregistration_set.all() if tr.out_of_tournament() is False]) |
|
|
|
current_team_count = self.teamregistration_set.exclude(walk_out=True).count() |
|
|
|
if current_team_count >= self.team_count: |
|
|
|
if current_team_count >= self.team_count: |
|
|
|
if self.waiting_list_limit is not None: |
|
|
|
if self.waiting_list_limit is not None: |
|
|
|
waiting_list_count = current_team_count - self.team_count |
|
|
|
waiting_list_count = current_team_count - self.team_count |
|
|
|
@ -1013,7 +1021,7 @@ class Tournament(models.Model): |
|
|
|
|
|
|
|
|
|
|
|
if self.team_count is not None: |
|
|
|
if self.team_count is not None: |
|
|
|
# Get all team registrations excluding walk_outs |
|
|
|
# Get all team registrations excluding walk_outs |
|
|
|
current_team_count = len([tr for tr in self.teamregistration_set.all() if tr.out_of_tournament() is False]) |
|
|
|
current_team_count = self.teamregistration_set.exclude(walk_out=True).count() |
|
|
|
if current_team_count >= self.team_count: |
|
|
|
if current_team_count >= self.team_count: |
|
|
|
if self.waiting_list_limit is not None: |
|
|
|
if self.waiting_list_limit is not None: |
|
|
|
waiting_list_count = current_team_count - self.team_count |
|
|
|
waiting_list_count = current_team_count - self.team_count |
|
|
|
@ -1048,7 +1056,7 @@ class Tournament(models.Model): |
|
|
|
return -1 |
|
|
|
return -1 |
|
|
|
|
|
|
|
|
|
|
|
# Get count of active teams (not walked out) |
|
|
|
# Get count of active teams (not walked out) |
|
|
|
current_team_count = len([tr for tr in self.teamregistration_set.all() if tr.out_of_tournament() is False]) |
|
|
|
current_team_count = self.teamregistration_set.exclude(walk_out=True).count() |
|
|
|
|
|
|
|
|
|
|
|
# If current count is less than target count, next team is not in waiting list |
|
|
|
# If current count is less than target count, next team is not in waiting list |
|
|
|
if current_team_count < self.team_count: |
|
|
|
if current_team_count < self.team_count: |
|
|
|
|