|
|
|
|
@ -25,13 +25,14 @@ class Match(models.Model): |
|
|
|
|
names = " / ".join(self.player_names()) |
|
|
|
|
return f"{self.stage_name()} #{self.index}: {names}" |
|
|
|
|
|
|
|
|
|
# player_names = " / ".join(self.player_names()) |
|
|
|
|
# if self.round: |
|
|
|
|
# return f"{match_name} > {player_names}" |
|
|
|
|
# elif self.group_stage: |
|
|
|
|
# return f"{match_name} > {player_names}" |
|
|
|
|
# else: |
|
|
|
|
# return "--" |
|
|
|
|
def tournament(self): |
|
|
|
|
if self.round: |
|
|
|
|
return self.round.tournament |
|
|
|
|
else: |
|
|
|
|
return self.group_stage.tournament |
|
|
|
|
|
|
|
|
|
def court_name(self, index): |
|
|
|
|
return self.tournament().event.club.court_name(index) |
|
|
|
|
|
|
|
|
|
def backup_name(self): |
|
|
|
|
items = [] |
|
|
|
|
@ -109,16 +110,11 @@ class Match(models.Model): |
|
|
|
|
_minutes = int((_seconds % 3600) / 60) |
|
|
|
|
return f"{_hours:02d}h{_minutes:02d}min" |
|
|
|
|
|
|
|
|
|
# def seconds(self): |
|
|
|
|
# return (timezone.now() - self.start_date).total_seconds() |
|
|
|
|
|
|
|
|
|
def live_match(self): |
|
|
|
|
title = self.name if self.name else self.backup_name() |
|
|
|
|
date = self.formatted_start_date() |
|
|
|
|
duration = self.time_indication() |
|
|
|
|
court = "" |
|
|
|
|
if self.court: |
|
|
|
|
court = f"Terrain {self.court}" |
|
|
|
|
court = self.court_name(self.court_index) |
|
|
|
|
|
|
|
|
|
ended = self.end_date is not None |
|
|
|
|
livematch = LiveMatch(title, date, duration, court, self.started(), ended) |
|
|
|
|
|