1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-24 17:42:23 +00:00

Display only one decimal in Google Sheet

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-03-30 17:23:31 +01:00
parent 2019c5c434
commit a914237f66
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -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 # Remove old protected ranges
for protected_range in spreadsheet.list_protected_ranges(worksheet.id): for protected_range in spreadsheet.list_protected_ranges(worksheet.id):
format_requests.append({ format_requests.append({