From fdd02e59223d955b0bb01484b4c25a5785e07c46 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Fri, 5 Jul 2024 17:02:47 +0200 Subject: [PATCH] Fix proxies Signed-off-by: Emmy D'Anello --- participation/models.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/participation/models.py b/participation/models.py index c1f46e7..1406330 100644 --- a/participation/models.py +++ b/participation/models.py @@ -478,10 +478,11 @@ class Tournament(models.Model): if worksheet.index != self.pools.count(): worksheet.update_index(self.pools.count()) - header = [[_("Team"), _("Scores day 1"), _("Tweaks day 1"), _("Scores day 2"), _("Tweaks day 2")] - + ([_("Total D1 + D2"), _("Scores day 3"), _("Tweaks day 3")] + header = [[str(_("Team")), str(_("Scores day 1")), str(_("Tweaks day 1")), + str(_("Scores day 2")), str(_("Tweaks day 2"))] + + ([str(_("Total D1 + D2")), str(_("Scores day 3")), str(_("Tweaks day 3"))] if settings.NB_ROUNDS >= 3 else []) - + [_("Total"), _("Rank")]] + + [str(_("Total")), str(_("Rank"))]] lines = [] participations = self.participations.filter(pools__round=1, pools__tournament=self).distinct().all() total_col, rank_col = ("F", "G") if settings.NB_ROUNDS == 2 else ("I", "J") @@ -548,7 +549,8 @@ class Tournament(models.Model): + (f" + (PI() - 2) * $G{i + 2} + $H{i + 2}" if settings.NB_ROUNDS >= 3 else "")) line.append(f"=RANG(${total_col}{i + 2}; ${total_col}$2:${total_col}${participations.count() + 1})") - final_ranking = [["", "", "", ""], ["", "", "", ""], [_("Team"), _("Score"), _("Rank"), _("Mention")], + final_ranking = [["", "", "", ""], ["", "", "", ""], + [str(_("Team")), str(_("Score")), str(_("Rank")), str(_("Mention"))], [f"=SORT($A$2:$A${participations.count() + 1}; " f"${total_col}$2:${total_col}${participations.count() + 1}; FALSE)", f"=SORT(${total_col}$2:${total_col}${participations.count() + 1}; " @@ -1236,13 +1238,13 @@ class Pool(models.Model): sum(([f"{_('Defender')} ({passage.defender.team.trigram})", "", f"{_('Opponent')} ({passage.opponent.team.trigram})", "", f"{_('Reviewer')} ({passage.reviewer.team.trigram})", ""] - + ([f"{('Observer')} ({passage.observer.team.trigram})", ""] if has_observer else []) - for passage in passages), start=["RĂ´le", ""]), + + ([f"{'Observer'} ({passage.observer.team.trigram})", ""] if has_observer else []) + for passage in passages), start=[str(_("Role")), ""]), sum(([f"{_('Writing')} (/{20 if settings.TFJM_APP == "TFJM" else 10})", f"{_('Oral')} (/{20 if settings.TFJM_APP == 'TFJM' else 10})" f"{_('Writing')} (/10)", f"{_('Oral')} (/10)", f"{_('Writing')} (/10)", f"{_('Oral')} (/10)"] + ([f"{_('Writing')} (/10)", f"{_('Oral')} (/10)"] if has_observer else []) - for _passage in passages), start=[_("Juree"), ""]), + for _passage in passages), start=[str(_("Juree")), ""]), ] notes = [[]] # Begin with empty hidden line to ensure pretty design @@ -1265,14 +1267,14 @@ class Pool(models.Model): return '' return getcol((number - 1) // 26) + chr(65 + (number - 1) % 26) - average = [_("Average"), ""] + average = [str(_("Average")), ""] coeffs = sum(([passage.coeff_defender_writing, passage.coeff_defender_oral, passage.coeff_opponent_writing, passage.coeff_opponent_oral, passage.coeff_reviewer_writing, passage.coeff_reviewer_oral] + ([passage.coeff_observer_writing, passage.coeff_observer_oral] if has_observer else []) for passage in passages), - start=[_("Coefficient"), ""]) - subtotal = [_("Subtotal"), ""] + start=[str(_("Coefficient")), ""]) + subtotal = [str(_("Subtotal")), ""] footer = [average, coeffs, subtotal, 34 * [""]] min_row = 5 @@ -1306,7 +1308,7 @@ class Pool(models.Model): f" + {obs_o_col}{max_row + 1} * {obs_o_col}{max_row + 2}", ""]) ranking = [ - [_("Team"), "", _("Problem"), _("Total"), _("Rank")], + [str(_("Team")), "", str(_("Problem")), str(_("Total")), str(_("Rank"))], ] all_passages = Passage.objects.filter(pool__tournament=self.tournament, pool__round=self.round, @@ -1353,7 +1355,7 @@ class Pool(models.Model): all_values = header + notes + footer + ranking worksheet.batch_clear([f"A1:AH{max_row + 5 + pool_size}"]) - worksheet.update("A1:AH", all_values, raw=False) + worksheet.update(all_values, "A1:AH", raw=False) format_requests = []