Fix plural of round names

sync_v2
Laurent 8 months ago
parent 3b8a03f92f
commit 21b0a85678
  1. 12
      tournaments/models/round.py
  2. 2
      tournaments/models/tournament.py
  3. 2
      tournaments/templates/tournaments/matches.html

@ -47,13 +47,19 @@ class Round(SideStoreModel):
if self.index == 0:
return "Finale"
elif self.index == 1:
return "Demies"
return "Demie"
elif self.index == 2:
return "Quarts"
return "Quart"
else:
squared = 2 ** self.index
return f"{squared}ème"
def plural_name(self):
name = self.name()
if self.parent is None and self.index > 0:
return f'{name}s'
return name
def ranking_matches(self, hide_empty_matches):
matches = []
for child in self.children.all():
@ -165,7 +171,7 @@ class Round(SideStoreModel):
if first_half_matches:
name = self.name()
name = self.plural_name()
if parent_round and first_half_matches[0].name is not None:
name = first_half_matches[0].name
match_group = self.tournament.create_match_group(

@ -533,7 +533,7 @@ class Tournament(BaseModel):
if round and matches:
matches.sort(key=lambda m: m.index)
group = self.create_match_group(round.name(), matches)
group = self.create_match_group(round.plural_name(), matches)
groups.append(group)
ranking_matches = round.ranking_matches(hide_empty_matches)

@ -21,7 +21,7 @@
{% endif %}
{% if tournament.display_matches %}
{% for round in rounds %}
<a href="{% url 'tournament' tournament.id %}?round={{ round.id }}" class="mybox topmargin5">{{ round.name }}</a>
<a href="{% url 'tournament' tournament.id %}?round={{ round.id }}" class="mybox topmargin5">{{ round.plural_name }}</a>
{% endfor %}
{% endif %}
</nav>

Loading…
Cancel
Save