FIX: fix ui bugs

This commit is contained in:
daovietanh99 2024-02-16 08:41:33 +07:00
parent f1baee2bf0
commit 82f268737a
2 changed files with 9 additions and 17 deletions

View File

@ -490,37 +490,29 @@ def dict2xlsx(input: json, _type='report'):
start_index = 4
for subtotal in input:
for key_index, key in enumerate(mapping.keys()):
for key in mapping.keys():
value = get_value(subtotal, mapping[key])
ws[key + str(start_index)] = value
ws[key + str(start_index)].border = border
if _type == 'report':
if key in ['J', 'L', 'M', 'N', 'O', 'P', 'Q']:
ws[key + str(start_index)].number_format = '0.0'
if subtotal['subs'] == '+':
ws[key + str(start_index)].font = font_black_bold
if key_index in [6, 8, 9, 10, 11, 12, 13]:
ws[key + str(start_index)].number_format = '0.0'
if key_index == 0 or (key_index >= 9 and key_index <= 15):
if key in ['A', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q']:
ws[key + str(start_index)].fill = fill_gray
elif key_index == 1:
elif key == 'B':
ws[key + str(start_index)].fill = fill_green
elif key_index >= 4 and key_index <= 8:
elif key in ['C', 'D', 'E', 'F', 'G', 'H']:
ws[key + str(start_index)].fill = fill_yellow
else:
if 'average_accuracy_rate' in mapping[key] and type(value) in [int, float]:
if value < 98:
if 'average_accuracy_rate' in mapping[key] and type(value) in [int, float] and value < 98:
ws[key + str(start_index)].style = normal_cell_red
ws[key + str(start_index)].number_format = '0.0'
elif 'average_processing_time' in mapping[key] and type(value) in [int, float]:
if value > 2.0:
elif 'average_processing_time' in mapping[key] and type(value) in [int, float] and value > 2.0:
ws[key + str(start_index)].style = normal_cell_red
ws[key + str(start_index)].number_format = '0.0'
elif 'bad_percent' in mapping[key] and type(value) in [int, float]:
if value > 10:
elif 'bad_percent' in mapping[key] and type(value) in [int, float] and value > 10:
ws[key + str(start_index)].style = normal_cell_red
ws[key + str(start_index)].number_format = '0.0'
elif 'percent' in mapping[key] and type(value) in [int, float]:
ws[key + str(start_index)].number_format = '0.0'
else :
ws[key + str(start_index)].style = normal_cell
elif _type == 'report_detail':

Binary file not shown.