Don't delete extra jury lines on Google Sheets
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
779aec5e55
commit
c4ec6a6f29
|
@ -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…
Reference in New Issue