Compare commits

...

2 Commits

Author SHA1 Message Date
Emmy D'Anello aac4fc59e6
Fix parsing tweaks
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-04-06 19:16:32 +02:00
Emmy D'Anello 78a43148a8
Fetch registrations by user id
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-04-06 19:12:10 +02:00
2 changed files with 9 additions and 1 deletions

View File

@ -47,7 +47,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
# Fetch the registration of the current user
user = self.scope['user']
reg = await Registration.objects.aget(user=user)
reg = await Registration.objects.aget(user_id=user.id)
self.registration = reg
# Accept the connection

View File

@ -607,12 +607,20 @@ class Tournament(models.Model):
worksheet.client.batch_update(spreadsheet.id, body)
def parse_tweaks_spreadskeets(self):
if not self.pools.exists():
# Draw has not been done yet
return
gc = gspread.service_account_from_dict(settings.GOOGLE_SERVICE_CLIENT)
spreadsheet = gc.open_by_key(self.notes_sheet_id)
worksheet = spreadsheet.worksheet("Classement final")
score_cell = worksheet.find("Score")
max_row = score_cell.row - 3
if max_row == 1:
# There is no team
return
data = worksheet.get_values(f"A2:E{max_row}")
for line in data:
trigram = line[0][-4:-1]