mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-02-24 13:41:19 +00:00
Compare commits
2 Commits
bf5c673739
...
c4ec6a6f29
Author | SHA1 | Date | |
---|---|---|---|
|
c4ec6a6f29 | ||
|
779aec5e55 |
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
from random import randint, shuffle
|
from random import randint, shuffle
|
||||||
|
|
||||||
from asgiref.sync import sync_to_async
|
from asgiref.sync import sync_to_async
|
||||||
@ -990,7 +991,9 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
if await pool.is_exportable():
|
if await pool.is_exportable():
|
||||||
await pool.export()
|
await pool.export()
|
||||||
|
|
||||||
await sync_to_async(self.tournament.update_ranking_spreadsheet)()
|
# Update Google Sheets final sheet
|
||||||
|
if os.getenv('GOOGLE_PRIVATE_KEY_ID', None):
|
||||||
|
await sync_to_async(self.tournament.update_ranking_spreadsheet)()
|
||||||
|
|
||||||
@ensure_orga
|
@ensure_orga
|
||||||
async def continue_final(self, **kwargs):
|
async def continue_final(self, **kwargs):
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# Copyright (C) 2023 by Animath
|
# Copyright (C) 2023 by Animath
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from asgiref.sync import sync_to_async
|
from asgiref.sync import sync_to_async
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||||
@ -399,7 +401,9 @@ class Pool(models.Model):
|
|||||||
passage.observer = tds[line[3]].participation
|
passage.observer = tds[line[3]].participation
|
||||||
await passage.asave()
|
await passage.asave()
|
||||||
|
|
||||||
await sync_to_async(self.associated_pool.update_spreadsheet)()
|
# Update Google Sheets
|
||||||
|
if os.getenv('GOOGLE_PRIVATE_KEY_ID', None):
|
||||||
|
await sync_to_async(self.associated_pool.update_spreadsheet)()
|
||||||
|
|
||||||
return self.associated_pool
|
return self.associated_pool
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ class Tournament(models.Model):
|
|||||||
else:
|
else:
|
||||||
tweak2_qs.update_or_create(defaults={'diff': tweak2_nb},
|
tweak2_qs.update_or_create(defaults={'diff': tweak2_nb},
|
||||||
create_defaults={'diff': tweak2_nb, 'pool': pool2,
|
create_defaults={'diff': tweak2_nb, 'pool': pool2,
|
||||||
'participation': participation})
|
'participation': participation})
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse_lazy("participation:tournament_detail", args=(self.pk,))
|
return reverse_lazy("participation:tournament_detail", args=(self.pk,))
|
||||||
@ -1269,13 +1269,9 @@ class Pool(models.Model):
|
|||||||
max_row = average_cell.row - 1
|
max_row = average_cell.row - 1
|
||||||
juries_visible = worksheet.get(f"A{min_row}:B{max_row}")
|
juries_visible = worksheet.get(f"A{min_row}:B{max_row}")
|
||||||
juries_visible = [t for t in juries_visible if t and len(t) == 2]
|
juries_visible = [t for t in juries_visible if t and len(t) == 2]
|
||||||
rows_to_delete = []
|
for i, (jury_name, jury_id) in enumerate(juries_visible):
|
||||||
for i, (_jury_name, jury_id) in enumerate(juries_visible):
|
|
||||||
if not jury_id.isnumeric() or int(jury_id) not in self.juries.values_list("id", flat=True):
|
if not jury_id.isnumeric() or int(jury_id) not in self.juries.values_list("id", flat=True):
|
||||||
rows_to_delete.append(min_row + i)
|
print(f"Warning: {jury_name} ({jury_id}) appears on the sheet but is not part of the jury.")
|
||||||
for row_to_delete in rows_to_delete:
|
|
||||||
worksheet.delete_rows(row_to_delete)
|
|
||||||
max_row -= len(rows_to_delete)
|
|
||||||
|
|
||||||
for jury in self.juries.all():
|
for jury in self.juries.all():
|
||||||
if str(jury.id) not in list(map(lambda x: x[1], juries_visible)):
|
if str(jury.id) not in list(map(lambda x: x[1], juries_visible)):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user