|
|
|
|
@ -33,11 +33,20 @@ class Match(models.Model): |
|
|
|
|
items = [] |
|
|
|
|
if self.round: |
|
|
|
|
items.append(self.round.name()) |
|
|
|
|
items.append(f" #{self.index}") |
|
|
|
|
elif self.group_stage: |
|
|
|
|
items.append(self.group_stage.name()) |
|
|
|
|
items.append(f"{self.index}") |
|
|
|
|
items.append(f"Match #{self.index}") |
|
|
|
|
return " ".join(items) |
|
|
|
|
|
|
|
|
|
def stage_name(self): |
|
|
|
|
if self.round: |
|
|
|
|
return self.round.name() |
|
|
|
|
elif self.group_stage: |
|
|
|
|
return self.group_stage.name() |
|
|
|
|
else: |
|
|
|
|
return '--' |
|
|
|
|
|
|
|
|
|
def player_names(self): |
|
|
|
|
return map(lambda ts: ts.player_names(), self.team_scores.all()) |
|
|
|
|
|
|
|
|
|
@ -48,6 +57,18 @@ class Match(models.Model): |
|
|
|
|
return '' |
|
|
|
|
# return str(self.start_date) #.strftime("%H:%M") |
|
|
|
|
|
|
|
|
|
def time_indication(self): |
|
|
|
|
if self.end_date: |
|
|
|
|
return self.formatted_duration() |
|
|
|
|
elif self.start_date: |
|
|
|
|
if self.started(): |
|
|
|
|
return self.formatted_duration() |
|
|
|
|
else: |
|
|
|
|
start = self.start_date.strftime("%H:%M") |
|
|
|
|
return f"Prévu à {start}" |
|
|
|
|
else: |
|
|
|
|
return 'À venir...' |
|
|
|
|
|
|
|
|
|
def current_duration(self): |
|
|
|
|
if self.end_date: |
|
|
|
|
return (self.end_date - self.start_date).total_seconds() |
|
|
|
|
@ -62,12 +83,6 @@ class Match(models.Model): |
|
|
|
|
else: |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
def durationPrefix(self): |
|
|
|
|
if self.current_duration() > 0: |
|
|
|
|
return "Temps de jeu" |
|
|
|
|
else: |
|
|
|
|
return "Démarrage prévu dans" |
|
|
|
|
|
|
|
|
|
def formatted_duration(self): |
|
|
|
|
|
|
|
|
|
_seconds = self.current_duration() |
|
|
|
|
@ -88,7 +103,7 @@ class Match(models.Model): |
|
|
|
|
def live_match(self): |
|
|
|
|
title = self.name() |
|
|
|
|
date = self.formatted_start_date() |
|
|
|
|
duration = self.formatted_duration() |
|
|
|
|
duration = self.time_indication() |
|
|
|
|
court = "" |
|
|
|
|
if self.court: |
|
|
|
|
court = f"Terrain {self.court}" |
|
|
|
|
|