1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 17:58:24 +02:00

Auto-generate tables

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-03-24 11:10:07 +01:00
parent 5399a875c6
commit f85a563cf3
4 changed files with 498 additions and 192 deletions

View File

@ -29,14 +29,14 @@
</div>
<div class="card-body">
<div class="row">
{% for participation in tournament.participations.all %}
<div class="col-md-1">
<div id="dice-{{ tournament.id }}-{{ participation.team.trigram }}"
class="badge rounded-pill text-bg-{% if participation.teamdraw_set.all.first.current.last_dice %}success{% else %}warning{% endif %}"
{% for td in tournament.draw.current_round.team_draws %}
<div class="col-md-1" style="order: {{ forloop.counter }};">
<div id="dice-{{ tournament.id }}-{{ td.participation.team.trigram }}"
class="badge rounded-pill text-bg-{% if td.last_dice %}success{% else %}warning{% endif %}"
{% if request.user.registration.is_volunteer %}
onclick="drawDice({{ tournament.id }}, '{{ participation.team.trigram }}')"
onclick="drawDice({{ tournament.id }}, '{{ td.participation.team.trigram }}')"
{% endif %}>
{{ participation.team.trigram }} 🎲 {{ participation.teamdraw_set.all.first.current.last_dice|default:'??' }}
{{ td.participation.team.trigram }} 🎲 {{ td.last_dice|default:'??' }}
</div>
</div>
{% endfor %}
@ -50,103 +50,47 @@
Recap
</div>
<div class="card-body">
<ul>
<li>
<strong>{% trans "Round 1" %}:</strong>
<ul>
<li>
<strong>Poule A</strong>
<ul>
<li>
<div class="badge rounded-pill text-bg-warning">
MSR 📃 ?
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️ 2, 3
</div>
<ul id="recap-{{ tournament.id }}-round-list" class="list-group list-group-flush">
{% for round in tournament.draw.round_set.all %}
<li id="recap-{{ tournament.id }}-round-{{ round.number }}"
class="list-group-item {% if tournament.draw.current_round == round %} list-group-item-primary{% endif %}"
data-tournament="{{ tournament.id }}">
<strong>{{ round }}</strong>
<ul id="recap-{{ tournament.id }}-round-{{ round.number }}-pool-list"
class="list-group list-group-flush">
{% for pool in round.pool_set.all %}
<li id="recap-{{ tournament.id }}-round-{{ round.number }}-pool-{{ pool.get_letter_display }}"
class="list-group-item {% if tournament.draw.current_round.current_pool == pool %} list-group-item-success{% endif %}"
data-tournament="{{ tournament.id }}">
<strong>{% trans "pool"|capfirst %} {{ pool }}</strong>
<ul id="recap-{{ tournament.id }}-round-{{ round.number }}-pool-{{ pool.get_letter_display }}-team-list"
class="list-group list-group-flush">
{% for td in pool.team_draws.all %}
<li id="recap-team-{{ td.participation.team.trigram }}"
class="list-group-item{% if tournament.draw.current_round.current_pool.current_team == td %} list-group-item-info{% endif %}"
data-tournament="{{ tournament.id }}">
<div id="recap-team-{{ td.participation.team.trigram }}-accepted"
class="badge rounded-pill text-bg-{% if td.accepted %}success{% else %}warning{% endif %}">
{{ td.participation.team.trigram }} 📃 {{ td.accepted|default:'?' }}
</div>
<div id="recap-team-{{ td.participation.team.trigram }}-rejected"
class="badge rounded-pill text-bg-danger">
🗑️ {{ td.rejected|join:', ' }}
</div>
{% if td.penalty %}
<div id="recap-team-{{ td.participation.team.trigram }}-penalty"
class="badge rounded-pill text-bg-info">
❌ {{ td.penalty }}
</div>
{% endif %}
</li>
{% endfor %}
</ul>
</li>
<li>
<div class="badge rounded-pill text-bg-success">
PON 📃 4
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️ 5, 6, 7, 8
</div>
<div class="badge rounded-pill text-bg-info">
❌ 0.5
</div>
</li>
<li>
<div class="badge rounded-pill text-bg-success">
CMS 📃 1
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️
</div>
</li>
</ul>
</li>
<li>
<strong>Poule B</strong>
<ul>
<li>
<div class="badge rounded-pill text-bg-warning">
ANT 📃 ?
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️
</div>
</li>
<li>
<div class="badge rounded-pill text-bg-success">
PBM 📃 ?
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️
</div>
</li>
<li>
<div class="badge rounded-pill text-bg-success">
LHP 📃 ?
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️
</div>
</li>
</ul>
</li>
<li>
<strong>Poule C</strong>
<ul>
<li>
<div class="badge rounded-pill text-bg-warning">
GJS 📃 ?
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️
</div>
</li>
<li>
<div class="badge rounded-pill text-bg-success">
DAT 📃 ?
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️
</div>
</li>
<li>
<div class="badge rounded-pill text-bg-success">
LHM 📃 ?
</div>
<div class="badge rounded-pill text-bg-danger">
🗑️
</div>
</li>
</ul>
</li>
</ul>
</li>
<li><strong>{% trans "Round 2" %}:</strong></li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
</div>
@ -185,95 +129,138 @@
</div>
</div>
<div class="row">
<div class="card col-md-6">
<div class="card-header">
<h2>
{% trans "Round 1" %}
</h2>
</div>
<div class="card-body">
<div class="card">
<div class="card-header">
<h3>
Poule A
</h3>
</div>
<div class="card-body">
<table class="table table-striped">
<thead>
<tr>
<th>Problem n°?</th>
<th>Problem n°?</th>
<th>Problem n°?</th>
</tr>
</thead>
<tbody>
<tr>
<td>???</td>
<td>???</td>
<td>???</td>
</tr>
<tr>
<td>???</td>
<td>???</td>
<td>???</td>
</tr>
<tr>
<td>???</td>
<td>???</td>
<td>???</td>
</tr>
</tbody>
</table>
</div>
<div id="tables-{{ tournament.id }}" class="row">
{% for round in tournament.draw.round_set.all %}
<div class="card col-md-6">
<div class="card-header">
<h2>
{{ round }}
</h2>
</div>
<div id="tables-{{ tournament.id }}-round-{{ round.number }}" class="card-body">
{% for pool in round.pool_set.all %}
{% if pool.teamdraw_set.count %}
<div class="card">
<div class="card-header">
<h3>
{% trans "pool"|capfirst %} {{ pool }}
</h3>
</div>
<div class="card-body">
<table id="table-{{ tournament.id }}-{{ round.number }}-{{ pool.get_letter_display }}" class="table table-striped">
<thead>
<tr>
<th class="text-center" rowspan="{% if pool.size == 5 %}3{% else %}2{% endif %}">{% trans "team"|capfirst %}</th>
<th class="text-center"{% if pool.size == 5 %} colspan="2"{% endif %}>Phase 1</th>
<th class="text-center"{% if pool.size == 5 %} colspan="2"{% endif %}>Phase 2</th>
<th class="text-center">Phase 3</th>
{% if pool.size == 4 %}
<th class="text-center">Phase 4</th>
{% endif %}
</tr>
{% if pool.size == 5 %}
<tr>
<th class="text-center">{% trans "Room" %} 1</th>
<th class="text-center">{% trans "Room" %} 2</th>
<th class="text-center">{% trans "Room" %} 1</th>
<th class="text-center">{% trans "Room" %} 2</th>
<th class="text-center">{% trans "Room" %} 1</th>
</tr>
{% endif %}
<tr>
{% for td in pool.team_draws.all %}
<th class="text-center">
{% trans "Problem"|capfirst %}
<span id="table-{{ tournament.id }}-round-{{ round.number }}-problem-{{ td.participation.team.trigram }}">{{ td.accepted|default:"?" }}</span>
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for td in pool.team_draws %}
<tr>
<td class="text-center">{{ td.participation.team.trigram }}</td>
{% if pool.size == 3 %}
{% if forloop.counter == 1 %}
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
{% elif forloop.counter == 2 %}
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
{% elif forloop.counter == 3 %}
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
{% endif %}
{% elif pool.size == 4 %}
{% if forloop.counter == 1 %}
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
{% elif forloop.counter == 2 %}
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
{% elif forloop.counter == 3 %}
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td></td>
{% elif forloop.counter == 4 %}
<td></td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
{% endif %}
{% elif pool.size == 5 %}
{% if forloop.counter == 1 %}
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td></td>
{% elif forloop.counter == 2 %}
<td></td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
{% elif forloop.counter == 3 %}
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
{% elif forloop.counter == 4 %}
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td></td>
{% elif forloop.counter == 4 %}
<td></td>
<td class="text-center">{% trans "reporter"|capfirst %}</td>
<td></td>
<td class="text-center">{% trans "opponent"|capfirst %}</td>
<td class="text-center">{% trans "defender"|capfirst %}</td>
<td></td>
{% endif %}
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
<div class="card col-md-6">
<div class="card-header">
<h2>
{% trans "Round 2" %}
</h2>
</div>
<div class="card-body">
<div class="card">
<div class="card-header">
<h3>
Poule A
</h3>
</div>
<div class="card-body">
<table class="table table-striped">
<thead>
<tr>
<th>Problem n°?</th>
<th>Problem n°?</th>
<th>Problem n°?</th>
</tr>
</thead>
<tbody>
<tr>
<td>???</td>
<td>???</td>
<td>???</td>
</tr>
<tr>
<td>???</td>
<td>???</td>
<td>???</td>
</tr>
<tr>
<td>???</td>
<td>???</td>
<td>???</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>