Fix total score in tfjm.org export for 5-teams pools

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-05-19 21:09:34 +02:00
parent 70050827d8
commit a43dc9c12a
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 12 additions and 11 deletions

View File

@ -52,11 +52,11 @@ class Command(BaseCommand):
self.w("<table>")
self.w("<thead>")
self.w("<tr>")
self.w("\t<th>Équipe</th>")
self.w("\t<th>Score Tour 1</th>")
self.w("\t<th>Score Tour 2</th>")
self.w("\t<th>Total</th>")
self.w("\t<th class=\"has-text-align-center\">Prix</th>")
self.w(" <th>Équipe</th>")
self.w(" <th>Score Tour 1</th>")
self.w(" <th>Score Tour 2</th>")
self.w(" <th>Total</th>")
self.w(" <th class=\"has-text-align-center\">Prix</th>")
self.w("</tr>")
self.w("</thead>")
self.w("<tbody>")
@ -64,16 +64,17 @@ class Command(BaseCommand):
self.w("<tr>")
bold = (not tournament.final and participation.final) or (tournament.final and i < 2)
if bold:
prefix, suffix = "\t<td><strong>", "</strong></td>"
prefix, suffix = " <td><strong>", "</strong></td>"
else:
prefix, suffix = "\t<td>", "</td>"
prefix, suffix = " <td>", "</td>"
self.w(f"{participation.team.name} ({participation.team.trigram})", prefix, suffix)
for pool in tournament.pools.filter(participations=participation).all():
pool_note = pool.average(participation)
for tournament_round in [1, 2]:
pool_note = sum(pool.average(participation)
for pool in tournament.pools.filter(participations=participation,
round=tournament_round).all())
self.w(f"{pool_note:.01f}", prefix, suffix)
self.w(f"{note:.01f}", prefix, suffix)
if tournament.final:
self.w(participation.mention_final if tournament.final else participation.mention, prefix, suffix)
self.w(participation.mention_final if tournament.final else participation.mention, prefix, suffix)
self.w("</tr>")
self.w("</tbody>")
self.w("</table>")