1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-23 15:16:38 +02:00

Fix tests

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-03-30 20:43:04 +01:00
parent 1e7bd209a1
commit 6867c2cc2d
3 changed files with 7 additions and 9 deletions

View File

@ -1,7 +1,6 @@
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
import asyncio
from datetime import date
import os
@ -16,7 +15,6 @@ from django.utils.crypto import get_random_string
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _
import gspread
from django.views.debug import ExceptionReporter
from gspread.utils import a1_range_to_grid_range, MergeType
from registration.models import Payment, VolunteerRegistration
from tfjm.lists import get_sympa_client
@ -434,7 +432,7 @@ class Tournament(models.Model):
gc = gspread.service_account_from_dict(settings.GOOGLE_SERVICE_CLIENT)
spreadsheet = gc.open_by_key(self.notes_sheet_id)
worksheets = spreadsheet.worksheets()
if f"Classement final" not in [ws.title for ws in worksheets]:
if "Classement final" not in [ws.title for ws in worksheets]:
worksheet = spreadsheet.add_worksheet("Classement final", 100, 26)
else:
worksheet = spreadsheet.worksheet("Classement final")
@ -477,7 +475,6 @@ class Tournament(models.Model):
data = header + lines + final_ranking
worksheet.update(data, f"A1:G{participations.count() + 5}", raw=False)
format_requests = []
# Set the width of the columns
@ -536,7 +533,7 @@ class Tournament(models.Model):
# Set background color for headers and footers
bg_colors = [("A1:AF", (1, 1, 1)),
(f"A1:G1", (0.8, 0.8, 0.8)),
("A1:G1", (0.8, 0.8, 0.8)),
(f"A2:B{participations.count() + 1}", (0.9, 0.9, 0.9)),
(f"C2:C{participations.count() + 1}", (1, 1, 1)),
(f"D2:D{participations.count() + 1}", (0.9, 0.9, 0.9)),
@ -581,7 +578,7 @@ class Tournament(models.Model):
})
# Protect the header, the juries list, the footer and the ranking
protected_ranges = [f"A1:G1", f"A2:B{participations.count() + 1}",
protected_ranges = ["A1:G1", f"A2:B{participations.count() + 1}",
f"D2:D{participations.count() + 1}", f"F2:G{participations.count() + 1}",
f"A{participations.count() + 4}:C{2 * participations.count() + 4}", ]
for protected_range in protected_ranges:
@ -1214,7 +1211,8 @@ class Pool(models.Model):
note.save()
def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
self.update_juries_lines_spreadsheet()
if os.getenv('GOOGLE_PRIVATE_KEY_ID', None): # Google Sheets support is enabled
self.update_juries_lines_spreadsheet()
super().save(force_insert, force_update, using, update_fields)
def __str__(self):