Various UI and graphic improvements

clubs
Laurent 1 year ago
parent bfcf3500ad
commit 4e56b71292
  1. 2
      tournaments/models/group_stage.py
  2. 27
      tournaments/models/match.py
  3. 9
      tournaments/models/player_registration.py
  4. 6
      tournaments/models/team_registration.py
  5. 6
      tournaments/models/team_score.py
  6. 9
      tournaments/models/tournament.py
  7. 10
      tournaments/static/tournaments/css/style.css
  8. 2
      tournaments/templates/tournaments/broadcast/broadcast.html
  9. 8
      tournaments/templates/tournaments/broadcast/broadcast_club.html
  10. 2
      tournaments/templates/tournaments/download.html
  11. 17
      tournaments/templates/tournaments/match_cell.html
  12. 2
      tournaments/templates/tournaments/team_row.html

@ -137,7 +137,7 @@ class LiveGroupStage:
class GroupStageTeam: class GroupStageTeam:
def __init__(self, team_registration): def __init__(self, team_registration):
self.names = team_registration.team_names() self.names = team_registration.shortened_team_names()
if team_registration.group_stage_position: if team_registration.group_stage_position:
self.position = team_registration.group_stage_position self.position = team_registration.group_stage_position
else: else:

@ -121,14 +121,14 @@ class Match(models.Model):
return games return games
def current_duration(self): def current_duration(self):
if self.start_date: if self.confirmed and self.start_date:
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() current = (timezone.now() - self.start_date).total_seconds()
if self.total_number_of_games() > 0 and current < self.average_seconds_duration() * 4: if self.total_number_of_games() > 0 and current < self.average_seconds_duration() * 4:
return current return current
elif self.total_number_of_games() == 0 and current < 4 * 60 * 60: elif self.total_number_of_games() == 0 and current < 3 * 60 * 60:
return current return current
else: else:
return None return None
@ -141,15 +141,15 @@ class Match(models.Model):
# return None # return None
# return (timezone.now() - self.start_date).total_seconds() # return (timezone.now() - self.start_date).total_seconds()
else: else:
return 0 return None
def started(self): def started(self):
if self.end_date: if self.confirmed:
return True if self.end_date:
elif self.start_date: return True
return timezone.now() > self.start_date elif self.start_date:
else: return timezone.now() > self.start_date
return False return False
def should_appear(self): def should_appear(self):
if self.disabled is True: if self.disabled is True:
@ -198,7 +198,7 @@ class Match(models.Model):
image = None image = None
weight= None weight= None
is_winner = False is_winner = False
names = team_score.team_names() names = team_score.shortened_team_names()
scores = team_score.scores_array() scores = team_score.scores_array()
walk_out = team_score.walk_out walk_out = team_score.walk_out
team = Team(image, names, scores, weight, is_winner, walk_out) team = Team(image, names, scores, weight, is_winner, walk_out)
@ -281,3 +281,10 @@ class LiveMatch:
if team.walk_out and len(team.scores) == 0: if team.walk_out and len(team.scores) == 0:
return False return False
return True return True
def should_show_scores(self):
if self.started:
for team in self.teams:
if len(team.scores) > 0:
return True
return False

@ -39,3 +39,12 @@ class PlayerRegistration(models.Model):
def name(self): def name(self):
return f"{self.first_name} {self.last_name}" return f"{self.first_name} {self.last_name}"
def shortened_name(self):
name = self.name()
if len(name) > 20 and self.first_name:
name = f"{self.first_name[0]}. {self.last_name}"
if len(name) > 20:
name_parts = self.last_name.split(" ")
name = f"{self.first_name[0]}. {name_parts[0]}"
return name

@ -43,6 +43,12 @@ class TeamRegistration(models.Model):
else: else:
return [pr.name() for pr in self.playerregistration_set.all()] return [pr.name() for pr in self.playerregistration_set.all()]
def shortened_team_names(self):
if self.name:
return [self.name]
else:
return [pr.shortened_name() for pr in self.playerregistration_set.all()]
def player_names(self): def player_names(self):
names = [pr.name() for pr in self.playerregistration_set.all()] names = [pr.name() for pr in self.playerregistration_set.all()]
str = " - ".join(names) str = " - ".join(names)

@ -23,6 +23,12 @@ class TeamScore(models.Model):
else: else:
return "--" return "--"
def shortened_team_names(self):
names = []
if self.team_registration:
names = self.team_registration.shortened_team_names()
return names
def team_names(self): def team_names(self):
names = [] names = []
if self.team_registration: if self.team_registration:

@ -124,6 +124,15 @@ class Tournament(models.Model):
def in_progress(self): def in_progress(self):
return self.end_date is None return self.end_date is None
def creator(self):
return self.event.creator.username
def private_label(self):
if self.is_private:
return "Privé"
else:
return "Public"
def summon_count_display(self): def summon_count_display(self):
teams = self.team_summons() teams = self.team_summons()
if teams is not None and len(teams) > 0: if teams is not None and len(teams) > 0:

@ -108,6 +108,10 @@ tr {
/* height: 40px; */ /* height: 40px; */
} }
.numbers {
font-feature-settings: "tnum";
}
.orange { .orange {
color: #f39200; color: #f39200;
} }
@ -250,7 +254,7 @@ tr {
.score { .score {
display: inline-block; display: inline-block;
font-size: 1.4em; font-size: 1.3em;
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
padding: 0px 5px; padding: 0px 5px;
@ -494,9 +498,9 @@ h-margin {
padding: 5px 0px; padding: 5px 0px;
} }
.table-row-4-colums-club-tournament { .table-row-6-colums-club-tournament {
display: grid; display: grid;
grid-template-columns: 100px 100px 1fr auto; grid-template-columns: 100px 80px 100px 80px 1fr auto;
align-items: center; align-items: center;
/* Vertically center the content within each column */ /* Vertically center the content within each column */
padding: 5px 0px; padding: 5px 0px;

@ -11,7 +11,7 @@
<div class="grid-x"> <div class="grid-x">
<div class="cell medium-6 large-6 topblock my-block"> <div class="cell medium-6 large-6 topblock my-block">
<div class="bubble"> <div class="bubble">
<div><a href="{% url 'automatic-broadcast' tournament.id %}">Automatic</a></div> <div><a href="{% url 'automatic-broadcast' tournament.id %}">Automatique</a></div>
<div><a href="{% url 'broadcasted-matches' tournament.id %}">Matchs</a></div> <div><a href="{% url 'broadcasted-matches' tournament.id %}">Matchs</a></div>
<div><a href="{% url 'broadcasted-group-stages' tournament.id %}">Poules</a></div> <div><a href="{% url 'broadcasted-group-stages' tournament.id %}">Poules</a></div>
<div><a href="{% url 'broadcasted-summons' tournament.id %}">Convocations</a></div> <div><a href="{% url 'broadcasted-summons' tournament.id %}">Convocations</a></div>

@ -13,13 +13,19 @@
{% for tournament in tournaments %} {% for tournament in tournaments %}
<div class="table-row-4-colums-club-tournament"> <div class="table-row-6-colums-club-tournament">
<div class="table-cell mybox center">{{ tournament.formatted_start_date }}</div> <div class="table-cell mybox center">{{ tournament.formatted_start_date }}</div>
<div class="tight table-cell"> <div class="tight table-cell">
<div class="large">{{ tournament.level }}</div> <div class="large">{{ tournament.level }}</div>
<div class="small">{{ tournament.category }}</div> <div class="small">{{ tournament.category }}</div>
</div> </div>
<div class="tight table-cell">
<span>{{ tournament.creator }}</span>
</div>
<div class="tight table-cell">
<span>{{ tournament.private_label }}</span>
</div>
<div class="table-cell"> <div class="table-cell">
<span><a href="{% url 'automatic-broadcast' tournament.id %}">Automatic</a></span> | <span><a href="{% url 'automatic-broadcast' tournament.id %}">Automatic</a></span> |
<span><a href="{% url 'broadcasted-matches' tournament.id %}">Matchs</a></span> | <span><a href="{% url 'broadcasted-matches' tournament.id %}">Matchs</a></span> |

@ -60,7 +60,7 @@
<span class="orange">Organisez vos tournois comme les pros</span> et accueillez les joueurs et le public comme dans les plus grands événements <span class="orange">Organisez vos tournois comme les pros</span> et accueillez les joueurs et le public comme dans les plus grands événements
</h3> </h3>
<p id="main"> <p id="main">
<span class="bold">PadelClub est une application de gestion de tournois destinée aux juges-arbitres, clubs et passionnés</span> qui souhaitent organiser aisément des tournois homologués ou amicaux. Gérez vos tournois de A à Z : des inscriptions jusqu’aux résultats finaux et retrouvez tous les résultats des matchs en temps réel. <span class="bold">Padel Club est une application de gestion de tournois destinée aux juges-arbitres, clubs et passionnés</span> qui souhaitent organiser aisément des tournois homologués ou amicaux. Gérez vos tournois de A à Z : des inscriptions jusqu’aux résultats finaux et retrouvez tous les résultats des matchs en ligne.
</p> </p>
</div> </div>
<div class="cell large-6 topblock center"> <div class="cell large-6 topblock center">

@ -21,23 +21,18 @@
{% endfor %} {% endfor %}
</div> </div>
{% if match.started %} {% if match.should_show_scores %}
<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 %}
<span class="score ws w60px">
{% if team.walk_out %}WO{% endif %}
</span>
{% endif %}
</div> </div>
{% elif match.has_walk_out %}
<span class="score ws w60px">
{% if team.walk_out %}WO{% endif %}
</span>
{% elif not tournament.hide_weight %} {% elif not tournament.hide_weight %}
<span class="score ws">{{ team.weight }}</span> <span class="score ws numbers">{{ team.weight }}</span>
{% endif %} {% endif %}
</div> </div>

@ -12,7 +12,7 @@
{% elif tournament.hide_weight %} {% elif tournament.hide_weight %}
<div class="table-cell right horizontal-padding"></div> <div class="table-cell right horizontal-padding"></div>
{% else %} {% else %}
<div class="table-cell right horizontal-padding large">{{ team.weight }}</div> <div class="table-cell right horizontal-padding large numbers">{{ team.weight }}</div>
{% endif %} {% endif %}
<div class="table-cell "><div class="mybox center">{{ team.stage }}</div></div> <div class="table-cell "><div class="mybox center">{{ team.stage }}</div></div>
</div> </div>

Loading…
Cancel
Save