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
1 changed files with 8 additions and 9 deletions

View File

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