1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-11-27 05:33:03 +00:00

Fix proxies

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-07-05 17:02:47 +02:00
parent d13ae89267
commit fdd02e5922
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -478,10 +478,11 @@ class Tournament(models.Model):
if worksheet.index != self.pools.count(): if worksheet.index != self.pools.count():
worksheet.update_index(self.pools.count()) worksheet.update_index(self.pools.count())
header = [[_("Team"), _("Scores day 1"), _("Tweaks day 1"), _("Scores day 2"), _("Tweaks day 2")] header = [[str(_("Team")), str(_("Scores day 1")), str(_("Tweaks day 1")),
+ ([_("Total D1 + D2"), _("Scores day 3"), _("Tweaks day 3")] 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 []) if settings.NB_ROUNDS >= 3 else [])
+ [_("Total"), _("Rank")]] + [str(_("Total")), str(_("Rank"))]]
lines = [] lines = []
participations = self.participations.filter(pools__round=1, pools__tournament=self).distinct().all() 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") 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 "")) + (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})") 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"=SORT($A$2:$A${participations.count() + 1}; "
f"${total_col}$2:${total_col}${participations.count() + 1}; FALSE)", f"${total_col}$2:${total_col}${participations.count() + 1}; FALSE)",
f"=SORT(${total_col}$2:${total_col}${participations.count() + 1}; " 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})", "", sum(([f"{_('Defender')} ({passage.defender.team.trigram})", "",
f"{_('Opponent')} ({passage.opponent.team.trigram})", "", f"{_('Opponent')} ({passage.opponent.team.trigram})", "",
f"{_('Reviewer')} ({passage.reviewer.team.trigram})", ""] f"{_('Reviewer')} ({passage.reviewer.team.trigram})", ""]
+ ([f"{('Observer')} ({passage.observer.team.trigram})", ""] if has_observer else []) + ([f"{'Observer'} ({passage.observer.team.trigram})", ""] if has_observer else [])
for passage in passages), start=["Rôle", ""]), for passage in passages), start=[str(_("Role")), ""]),
sum(([f"{_('Writing')} (/{20 if settings.TFJM_APP == "TFJM" else 10})", sum(([f"{_('Writing')} (/{20 if settings.TFJM_APP == "TFJM" else 10})",
f"{_('Oral')} (/{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)", f"{_('Writing')} (/10)", f"{_('Oral')} (/10)"]
+ ([f"{_('Writing')} (/10)", f"{_('Oral')} (/10)"] if has_observer else []) + ([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 notes = [[]] # Begin with empty hidden line to ensure pretty design
@ -1265,14 +1267,14 @@ class Pool(models.Model):
return '' return ''
return getcol((number - 1) // 26) + chr(65 + (number - 1) % 26) 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, coeffs = sum(([passage.coeff_defender_writing, passage.coeff_defender_oral,
passage.coeff_opponent_writing, passage.coeff_opponent_oral, passage.coeff_opponent_writing, passage.coeff_opponent_oral,
passage.coeff_reviewer_writing, passage.coeff_reviewer_oral] passage.coeff_reviewer_writing, passage.coeff_reviewer_oral]
+ ([passage.coeff_observer_writing, passage.coeff_observer_oral] if has_observer else []) + ([passage.coeff_observer_writing, passage.coeff_observer_oral] if has_observer else [])
for passage in passages), for passage in passages),
start=[_("Coefficient"), ""]) start=[str(_("Coefficient")), ""])
subtotal = [_("Subtotal"), ""] subtotal = [str(_("Subtotal")), ""]
footer = [average, coeffs, subtotal, 34 * [""]] footer = [average, coeffs, subtotal, 34 * [""]]
min_row = 5 min_row = 5
@ -1306,7 +1308,7 @@ class Pool(models.Model):
f" + {obs_o_col}{max_row + 1} * {obs_o_col}{max_row + 2}", ""]) f" + {obs_o_col}{max_row + 1} * {obs_o_col}{max_row + 2}", ""])
ranking = [ ranking = [
[_("Team"), "", _("Problem"), _("Total"), _("Rank")], [str(_("Team")), "", str(_("Problem")), str(_("Total")), str(_("Rank"))],
] ]
all_passages = Passage.objects.filter(pool__tournament=self.tournament, all_passages = Passage.objects.filter(pool__tournament=self.tournament,
pool__round=self.round, pool__round=self.round,
@ -1353,7 +1355,7 @@ class Pool(models.Model):
all_values = header + notes + footer + ranking all_values = header + notes + footer + ranking
worksheet.batch_clear([f"A1:AH{max_row + 5 + pool_size}"]) 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 = [] format_requests = []