|
|
|
|
@ -995,19 +995,17 @@ class Tournament(models.Model): |
|
|
|
|
return self.hide_teams_weight |
|
|
|
|
|
|
|
|
|
def is_build_and_not_empty(self): |
|
|
|
|
# if hasattr(self, '_prefetched_objects_cache'): |
|
|
|
|
# # Use prefetched data if available |
|
|
|
|
# has_group_stages = 'groupstage_set' in self._prefetched_objects_cache and len(self.groupstage_set.all()) > 0 |
|
|
|
|
# has_rounds = 'round_set' in self._prefetched_objects_cache and len(self.round_set.all()) > 0 |
|
|
|
|
# has_team_registrations = 'teamregistration_set' in self._prefetched_objects_cache and len(self.teamregistration_set.all()) >= 4 |
|
|
|
|
# else: |
|
|
|
|
# # Fall back to database queries if not prefetched |
|
|
|
|
# has_group_stages = self.groupstage_set.count() > 0 |
|
|
|
|
# has_rounds = self.round_set.count() > 0 |
|
|
|
|
# has_team_registrations = self.teamregistration_set.count() >= 4 |
|
|
|
|
if hasattr(self, '_prefetched_objects_cache'): |
|
|
|
|
# Use prefetched data if available |
|
|
|
|
has_group_stages = 'groupstage_set' in self._prefetched_objects_cache and len(self.groupstage_set.all()) > 0 |
|
|
|
|
has_rounds = 'round_set' in self._prefetched_objects_cache and len(self.round_set.all()) > 0 |
|
|
|
|
has_team_registrations = 'teamregistration_set' in self._prefetched_objects_cache and len(self.teamregistration_set.all()) >= 4 |
|
|
|
|
else: |
|
|
|
|
# Fall back to database queries if not prefetched |
|
|
|
|
has_group_stages = self.groupstage_set.count() > 0 |
|
|
|
|
has_rounds = self.round_set.count() > 0 |
|
|
|
|
has_team_registrations = self.teamregistration_set.count() >= 4 |
|
|
|
|
|
|
|
|
|
return (has_group_stages or has_rounds) and has_team_registrations |
|
|
|
|
|
|
|
|
|
def day_duration_formatted(self): |
|
|
|
|
|