From a914237f667706dad3672e2031274c14dcfbe433 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 30 Mar 2024 17:23:31 +0100 Subject: [PATCH] Display only one decimal in Google Sheet Signed-off-by: Emmy D'Anello --- participation/models.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/participation/models.py b/participation/models.py index a26df3b..e8b0127 100644 --- a/participation/models.py +++ b/participation/models.py @@ -924,6 +924,19 @@ class Pool(models.Model): } }) + # Set number format, display only one decimal + number_format_ranges = [f"C{max_row + 1}:{getcol(2 + passage_width * pool_size)}{max_row + 1}", + f"C{max_row + 3}:{getcol(2 + passage_width * pool_size)}{max_row + 3}", + f"D{max_row + 6}:D{max_row + 5 + pool_size}",] + for number_format_range in number_format_ranges: + format_requests.append({ + "repeatCell": { + "range": a1_range_to_grid_range(number_format_range, worksheet.id), + "cell": {"userEnteredFormat": {"numberFormat": {"type": "NUMBER", "pattern": "0.0"}}}, + "fields": "userEnteredFormat.numberFormat", + } + }) + # Remove old protected ranges for protected_range in spreadsheet.list_protected_ranges(worksheet.id): format_requests.append({