From c4ec6a6f2990171e8c7268673e4111c3bd1e4965 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 31 Mar 2024 15:34:21 +0200 Subject: [PATCH] Don't delete extra jury lines on Google Sheets Signed-off-by: Emmy D'Anello --- participation/models.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/participation/models.py b/participation/models.py index 07a0636..107aabb 100644 --- a/participation/models.py +++ b/participation/models.py @@ -1269,13 +1269,9 @@ class Pool(models.Model): max_row = average_cell.row - 1 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] - 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): - rows_to_delete.append(min_row + i) - for row_to_delete in rows_to_delete: - worksheet.delete_rows(row_to_delete) - max_row -= len(rows_to_delete) + print(f"Warning: {jury_name} ({jury_id}) appears on the sheet but is not part of the jury.") for jury in self.juries.all(): if str(jury.id) not in list(map(lambda x: x[1], juries_visible)):