|
|
|
@ -279,8 +279,15 @@ 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 False |
|
|
|
return False |
|
|
|
elif datetime.now().date() >= first_group_stage_start_date.date(): |
|
|
|
|
|
|
|
|
|
|
|
group_stage_start_date = self.getEightAm(first_group_stage_start_date) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if group_stage_start_date < self.start_date: |
|
|
|
|
|
|
|
group_stage_start_date = self.start_date |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if datetime.now().date() >= group_stage_start_date.date(): |
|
|
|
return True |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
def group_stage_start_date(self): |
|
|
|
def group_stage_start_date(self): |
|
|
|
@ -297,8 +304,14 @@ 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 False |
|
|
|
return False |
|
|
|
elif datetime.now().date() >= first_match_start_date.date(): |
|
|
|
|
|
|
|
|
|
|
|
bracket_start_date = self.getEightAm(first_match_start_date) |
|
|
|
|
|
|
|
if bracket_start_date < self.start_date: |
|
|
|
|
|
|
|
bracket_start_date = self.start_date |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if datetime.now().date() >= bracket_start_date.date(): |
|
|
|
return True |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
def bracket_matches(self): |
|
|
|
def bracket_matches(self): |
|
|
|
@ -311,6 +324,9 @@ 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] |
|
|
|
return min(matches, key=lambda m: m.start_date).start_date |
|
|
|
return min(matches, key=lambda m: m.start_date).start_date |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getEightAm(self, date): |
|
|
|
|
|
|
|
return date.replace(hour=8, minute=0, second=0, microsecond=0) |
|
|
|
|
|
|
|
|
|
|
|
class MatchGroup: |
|
|
|
class MatchGroup: |
|
|
|
def __init__(self, name, matches): |
|
|
|
def __init__(self, name, matches): |
|
|
|
self.name = name |
|
|
|
self.name = name |
|
|
|
|