|
|
|
@ -900,7 +900,28 @@ class Tournament(models.Model): |
|
|
|
timezoned_datetime = timezone.localtime(self.start_date) |
|
|
|
timezoned_datetime = timezone.localtime(self.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() |
|
|
|
return now >= end and self.is_build_and_not_empty() and self.nearly_over() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def nearly_over(self): |
|
|
|
|
|
|
|
# First check group stages if they exist |
|
|
|
|
|
|
|
if self.groupstage_set.count() > 0: |
|
|
|
|
|
|
|
# Check if all group stages are completed |
|
|
|
|
|
|
|
for group_stage in self.groupstage_set.all(): |
|
|
|
|
|
|
|
if group_stage.is_completed(): |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If no group stages, check semi-finals |
|
|
|
|
|
|
|
if self.round_set.count() > 0: |
|
|
|
|
|
|
|
# Get round with index 1 (semi-finals) and no parent |
|
|
|
|
|
|
|
semifinals = self.round_set.filter(index=1, parent=None).first() |
|
|
|
|
|
|
|
if semifinals: |
|
|
|
|
|
|
|
# Check if any match in semi-finals has started |
|
|
|
|
|
|
|
for match in semifinals.match_set.all(): |
|
|
|
|
|
|
|
if match.start_date is not None and match.is_ready(): |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|