1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-23 20:36:39 +02:00

Fix notation sheets when we change the order of pools

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-04-17 22:02:29 +02:00
parent 91a1837c99
commit 059cae75c5
2 changed files with 13 additions and 57 deletions

View File

@ -1085,36 +1085,15 @@ class Pool(models.Model):
ranking = [
["Équipe", "", "Problème", "Total", "Rang"],
]
passage_matrix = []
match pool_size:
case 3:
passage_matrix = [
[0, 2, 1],
[1, 0, 2],
[2, 1, 0],
]
case 4:
passage_matrix = [
[0, 3, 2],
[1, 0, 3],
[2, 1, 0],
[3, 2, 1],
]
case 5:
passage_matrix = [
[0, 2, 3],
[1, 4, 2],
[2, 0, 4],
[3, 1, 0],
[4, 3, 1],
]
for passage in passages:
participation = passage.defender
passage_line = passage_matrix[passage.position - 1]
defender_pos = passage.position - 1
opponent_pos = passages.get(opponent=passage.defender).position - 1
reporter_pos = passages.get(reporter=passage.defender).position - 1
formula = "="
formula += getcol(min_column + passage_line[0] * passage_width) + str(max_row + 3) # Defender
formula += " + " + getcol(min_column + passage_line[1] * passage_width + 2) + str(max_row + 3) # Opponent
formula += " + " + getcol(min_column + passage_line[2] * passage_width + 4) + str(max_row + 3) # Reporter
formula += getcol(min_column + defender_pos * passage_width) + str(max_row + 3) # Defender
formula += " + " + getcol(min_column + opponent_pos * passage_width + 2) + str(max_row + 3) # Opponent
formula += " + " + getcol(min_column + reporter_pos * passage_width + 4) + str(max_row + 3) # Reporter
ranking.append([f"{participation.team.name} ({participation.team.trigram})", "",
f"=${getcol(3 + (passage.position - 1) * passage_width)}$1", formula,
f"=RANG(D{max_row + 5 + passage.position}; "