Improves WO layout

clubs
Laurent 2 years ago
parent 70a5f994cd
commit 58286464d0
  1. 9
      static/tournaments/css/style.css
  2. 15
      tournaments/models/match.py
  3. 8
      tournaments/models/team_score.py
  4. 2
      tournaments/models/tournament.py
  5. 9
      tournaments/static/tournaments/css/style.css
  6. 15
      tournaments/templates/tournaments/match_cell.html

@ -426,6 +426,15 @@ tr {
width: 100%; width: 100%;
} }
.w40px {
width: 40px;
}
.w60px {
width: 60px;
}
.w70px {
width: 70px;
}
.w80px { .w80px {
width: 80px; width: 80px;
} }

@ -20,7 +20,8 @@ class Match(models.Model):
broadcasted = models.BooleanField(default=False) broadcasted = models.BooleanField(default=False)
def __str__(self): def __str__(self):
return " / ".join(self.player_names()) names = " / ".join(self.player_names())
return f"{self.stage_name()}: {names}"
# player_names = " / ".join(self.player_names()) # player_names = " / ".join(self.player_names())
# if self.round: # if self.round:
@ -188,3 +189,15 @@ class LiveMatch:
"court": self.court, "court": self.court,
"started": self.started, "started": self.started,
} }
def has_walk_out(self):
for team in self.teams:
if team.walk_out:
return True
return False
def show_duration(self):
for team in self.teams:
if team.walk_out and len(team.scores) == 0:
return False
return True

@ -8,7 +8,7 @@ class TeamScore(models.Model):
team_registration = models.ForeignKey(TeamRegistration, on_delete=models.CASCADE, null=True, blank=True) team_registration = models.ForeignKey(TeamRegistration, on_delete=models.CASCADE, null=True, blank=True)
player_registrations = models.ManyToManyField(PlayerRegistration, blank=True) player_registrations = models.ManyToManyField(PlayerRegistration, blank=True)
score = models.CharField(max_length=50, null=True, blank=True) score = models.CharField(max_length=50, null=True, blank=True)
walk_out = models.IntegerField(null=True, blank=True) #id, int of the walked_out team walk_out = models.IntegerField(null=True, blank=True) # TODO type of WO: forfeit, injury...
lucky_loser = models.BooleanField() lucky_loser = models.BooleanField()
def __str__(self): def __str__(self):
@ -40,9 +40,3 @@ class TeamScore(models.Model):
return [x for x in self.score.split(',')] return [x for x in self.score.split(',')]
else: else:
return [] return []
# scores = []
# if self.score:
# scores = [x for x in self.score.split(',')]
# if self.walk_out == 1:
# scores.insert(0, 'WO')
# return scores

@ -90,7 +90,7 @@ class Tournament(models.Model):
def all_groups(self, broadcasted): def all_groups(self, broadcasted):
groups = [] groups = []
for round in self.round_set.all(): for round in self.round_set.all().order_by('index'):
groups.extend(self.round_match_groups(round, broadcasted, hide_empty_matches=True)) groups.extend(self.round_match_groups(round, broadcasted, hide_empty_matches=True))
for group_stage in self.groupstage_set.all(): for group_stage in self.groupstage_set.all():
group = self.group_stage_match_group(group_stage, broadcasted, hide_empty_matches=True) group = self.group_stage_match_group(group_stage, broadcasted, hide_empty_matches=True)

@ -473,6 +473,15 @@ tr {
.w20px { .w20px {
width: 20px; width: 20px;
} }
.w40px {
width: 40px;
}
.w60px {
width: 60px;
}
.w70px {
width: 7px;
}
.w80px { .w80px {
width: 80px; width: 80px;
} }

@ -22,15 +22,18 @@
</div> </div>
<!-- <div class="scores"> --> <!-- <div class="scores"> -->
{% if match.started %} {% if match.started %}
{% if team.walk_out %}
<span class="score ws">WO</span>
{% else %}
{% for score in team.scores %} {% for score in team.scores %}
<div class="scores"> <div class="scores">
<span class="score ws{% if team.is_winner %} winner{% endif %}">{{ score }}</span> <span class="score ws{% if team.is_winner %} winner{% endif %}">{{ score }}</span>
</div> </div>
{% endfor %} {% endfor %}
{% if match.has_walk_out %}
<span class="score ws w60px">
{% if team.walk_out %}WO{% endif %}
</span>
{% endif %} {% endif %}
{% else %} {% else %}
<span class="score ws">{{ team.weight }}</span> <span class="score ws">{{ team.weight }}</span>
{% endif %} {% endif %}
@ -42,7 +45,11 @@
</div> </div>
<div class="flex-row top-margin"> <div class="flex-row top-margin">
<label class="left-label minor-info bold">{{ match.duration }}</label> <label class="left-label minor-info bold">
{% if match.show_duration %}
{{ match.duration }}
{% endif %}
</label>
<label class="right-label minor-info">{{ match.court }}</label> <label class="right-label minor-info">{{ match.court }}</label>
<!-- <a href="" class="right-label">{{ match.court }}</a> --> <!-- <a href="" class="right-label">{{ match.court }}</a> -->
</div> </div>

Loading…
Cancel
Save