|
|
|
|
@ -1013,9 +1013,9 @@ class Tournament(BaseModel): |
|
|
|
|
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.group_stages.all()) > 0 |
|
|
|
|
has_rounds = 'round_set' in self._prefetched_objects_cache and len(self.rounds.all()) > 0 |
|
|
|
|
has_team_registrations = 'teamregistration_set' in self._prefetched_objects_cache and len(self.team_registrations.all()) >= 4 |
|
|
|
|
has_group_stages = 'group_stages' in self._prefetched_objects_cache and len(self.group_stages.all()) > 0 |
|
|
|
|
has_rounds = 'rounds' in self._prefetched_objects_cache and len(self.rounds.all()) > 0 |
|
|
|
|
has_team_registrations = 'team_registrations' in self._prefetched_objects_cache and len(self.team_registrations.all()) >= 4 |
|
|
|
|
else: |
|
|
|
|
# Fall back to database queries if not prefetched |
|
|
|
|
has_group_stages = self.group_stages.count() > 0 |
|
|
|
|
|