Fix missing info during matches

clubs
Laurent 1 year ago
parent 23105227c1
commit 58bea385a3
  1. 8
      tournaments/models/match.py
  2. 6
      tournaments/templates/tournaments/match_cell.html

@ -105,7 +105,6 @@ class Match(models.Model):
def magic_duration(self): def magic_duration(self):
seconds = (self.end_date - self.start_date).total_seconds() seconds = (self.end_date - self.start_date).total_seconds()
average_duration = self.average_seconds_duration() average_duration = self.average_seconds_duration()
# print(f"{average_duration} / {seconds}")
if (average_duration / 2) > seconds or seconds > (average_duration * 2): if (average_duration / 2) > seconds or seconds > (average_duration * 2):
seconds = average_duration seconds = average_duration
@ -126,12 +125,7 @@ class Match(models.Model):
if self.end_date: if self.end_date:
return (self.end_date - self.start_date).total_seconds() return (self.end_date - self.start_date).total_seconds()
else: else:
current = (timezone.now() - self.start_date).total_seconds() return (timezone.now() - self.start_date).total_seconds()
if current < self.average_seconds_duration() * 2:
return current
else:
return None
# return (timezone.now() - self.start_date).total_seconds()
else: else:
return 0 return 0

@ -23,17 +23,19 @@
{% if match.started %} {% if match.started %}
<div class="scores"> <div class="scores">
{% if team.scores %}
{% for score in team.scores %} {% for score in team.scores %}
<span class="score ws w30px{% if team.is_winner %} winner{% endif %}">{{ score }}</span> <span class="score ws w30px{% if team.is_winner %} winner{% endif %}">{{ score }}</span>
{% endfor %} {% endfor %}
{% else %}
<span class="score ws">{{ team.weight }}</span>
{% endif %}
{% if match.has_walk_out %} {% if match.has_walk_out %}
<span class="score ws w60px"> <span class="score ws w60px">
{% if team.walk_out %}WO{% endif %} {% if team.walk_out %}WO{% endif %}
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% elif not tournament.hide_weight %} {% elif not tournament.hide_weight %}
<span class="score ws">{{ team.weight }}</span> <span class="score ws">{{ team.weight }}</span>
{% endif %} {% endif %}

Loading…
Cancel
Save