UPDATE: chang number format to 1 decimal place

This commit is contained in:
daovietanh99 2024-02-15 15:23:42 +07:00
parent a7b86730aa
commit 1e49e14e4c

View File

@ -524,8 +524,10 @@ def dict2xlsx(input: json, _type='report'):
ws[key + str(start_index)].style = normal_cell ws[key + str(start_index)].style = normal_cell
elif _type == 'report_detail': elif _type == 'report_detail':
if 'accuracy' in mapping[key] and type(value) in [int, float] and value < 75: if 'accuracy' in mapping[key] and type(value) in [int, float] and value < 75:
ws[key + str(start_index)].number_format = '0.0'
ws[key + str(start_index)].style = normal_cell_red ws[key + str(start_index)].style = normal_cell_red
elif 'speed' in mapping[key] and type(value) in [int, float] and value > 2.0: elif 'speed' in mapping[key] and type(value) in [int, float] and value > 2.0:
ws[key + str(start_index)].number_format = '0.0'
ws[key + str(start_index)].style = normal_cell_red ws[key + str(start_index)].style = normal_cell_red
else: else:
ws[key + str(start_index)].style = normal_cell ws[key + str(start_index)].style = normal_cell