From a43dc9c12acdb9df5a6272897085934ab057a15b Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 19 May 2024 21:09:34 +0200 Subject: [PATCH] Fix total score in tfjm.org export for 5-teams pools Signed-off-by: Emmy D'Anello --- .../management/commands/export_results.py | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/participation/management/commands/export_results.py b/participation/management/commands/export_results.py index 55ee898..2cf4d04 100644 --- a/participation/management/commands/export_results.py +++ b/participation/management/commands/export_results.py @@ -52,11 +52,11 @@ class Command(BaseCommand): self.w("") self.w("") self.w("") - self.w("\t") - self.w("\t") - self.w("\t") - self.w("\t") - self.w("\t") + self.w(" ") + self.w(" ") + self.w(" ") + self.w(" ") + self.w(" ") self.w("") self.w("") self.w("") @@ -64,16 +64,17 @@ class Command(BaseCommand): self.w("") bold = (not tournament.final and participation.final) or (tournament.final and i < 2) if bold: - prefix, suffix = "\t" + prefix, suffix = " " else: - prefix, suffix = "\t" + prefix, suffix = " " 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("") self.w("") self.w("
ÉquipeScore Tour 1Score Tour 2TotalPrixÉquipeScore Tour 1Score Tour 2TotalPrix
", "", "", "", "
")