1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-24 17:42:23 +00:00

Better bold lines in tfjm.org export

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-05-19 21:02:44 +02:00
parent f687deed14
commit 70050827d8
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -17,8 +17,8 @@ class Command(BaseCommand):
self.w("") self.w("")
self.w("") self.w("")
def w(self, msg): def w(self, msg, prefix="", suffix=""):
self.stdout.write(msg) self.stdout.write(f"{prefix}{msg}{suffix}")
def handle_tournament(self, tournament): def handle_tournament(self, tournament):
name = tournament.name name = tournament.name
@ -64,17 +64,16 @@ class Command(BaseCommand):
self.w("<tr>") self.w("<tr>")
bold = (not tournament.final and participation.final) or (tournament.final and i < 2) bold = (not tournament.final and participation.final) or (tournament.final and i < 2)
if bold: if bold:
self.w(f"\t<th>{participation.team.name} ({participation.team.trigram})</th>") prefix, suffix = "\t<td><strong>", "</strong></td>"
else: else:
self.w(f"\t<td>{participation.team.name} ({participation.team.trigram})</td>") prefix, suffix = "\t<td>", "</td>"
self.w(f"{participation.team.name} ({participation.team.trigram})", prefix, suffix)
for pool in tournament.pools.filter(participations=participation).all(): for pool in tournament.pools.filter(participations=participation).all():
pool_note = pool.average(participation) pool_note = pool.average(participation)
self.w(f"\t<td>{pool_note:.01f}</td>") self.w(f"{pool_note:.01f}", prefix, suffix)
self.w(f"\t<td>{note:.01f}</td>") self.w(f"{note:.01f}", prefix, suffix)
if tournament.final: if tournament.final:
self.w(f"\t<td>{participation.mention_final}</td>") self.w(participation.mention_final if tournament.final else participation.mention, prefix, suffix)
else:
self.w(f"\t<td>{participation.mention}</td>")
self.w("</tr>") self.w("</tr>")
self.w("</tbody>") self.w("</tbody>")
self.w("</table>") self.w("</table>")