UPDATE: update report xlsx and file utils
This commit is contained in:
parent
1416cd04d2
commit
a7b86730aa
@ -443,20 +443,21 @@ def dict2xlsx(input: json, _type='report'):
|
|||||||
mapping = {
|
mapping = {
|
||||||
'A': 'subs',
|
'A': 'subs',
|
||||||
'B': 'extraction_date',
|
'B': 'extraction_date',
|
||||||
'C': 'num_imei',
|
'C': 'usage.total_images',
|
||||||
'D': 'num_invoice',
|
'D': 'usage.imei',
|
||||||
'E': 'total_images',
|
'E': 'usage.invoice',
|
||||||
'F': 'images_quality.successful',
|
'F': 'total_images',
|
||||||
'G': 'images_quality.successful_percent',
|
'G': 'num_imei',
|
||||||
'H': 'images_quality.bad',
|
'H': 'num_invoice',
|
||||||
'I': 'images_quality.bad_percent',
|
'I': 'images_quality.successful',
|
||||||
'J': 'average_accuracy_rate.imei',
|
'J': 'images_quality.successful_percent',
|
||||||
'K': 'average_accuracy_rate.purchase_date',
|
'K': 'images_quality.bad',
|
||||||
'L': 'average_accuracy_rate.retailer_name',
|
'L': 'images_quality.bad_percent',
|
||||||
'M': 'average_processing_time.imei',
|
'M': 'average_accuracy_rate.imei',
|
||||||
'N': 'average_processing_time.invoice',
|
'N': 'average_accuracy_rate.purchase_date',
|
||||||
'O': 'usage.imei',
|
'O': 'average_accuracy_rate.retailer_name',
|
||||||
'P': 'usage.invoice',
|
'P': 'average_processing_time.imei',
|
||||||
|
'Q': 'average_processing_time.invoice',
|
||||||
}
|
}
|
||||||
start_index = 5
|
start_index = 5
|
||||||
|
|
||||||
@ -497,7 +498,7 @@ def dict2xlsx(input: json, _type='report'):
|
|||||||
if subtotal['subs'] == '+':
|
if subtotal['subs'] == '+':
|
||||||
ws[key + str(start_index)].font = font_black_bold
|
ws[key + str(start_index)].font = font_black_bold
|
||||||
if key_index in [6, 8, 9, 10, 11, 12, 13]:
|
if key_index in [6, 8, 9, 10, 11, 12, 13]:
|
||||||
ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00
|
ws[key + str(start_index)].number_format = '0.0'
|
||||||
if key_index == 0 or (key_index >= 9 and key_index <= 15):
|
if key_index == 0 or (key_index >= 9 and key_index <= 15):
|
||||||
ws[key + str(start_index)].fill = fill_gray
|
ws[key + str(start_index)].fill = fill_gray
|
||||||
elif key_index == 1:
|
elif key_index == 1:
|
||||||
@ -506,19 +507,19 @@ def dict2xlsx(input: json, _type='report'):
|
|||||||
ws[key + str(start_index)].fill = fill_yellow
|
ws[key + str(start_index)].fill = fill_yellow
|
||||||
else:
|
else:
|
||||||
if 'average_accuracy_rate' in mapping[key] and type(value) in [int, float]:
|
if 'average_accuracy_rate' in mapping[key] and type(value) in [int, float]:
|
||||||
if value < 95:
|
if value < 98:
|
||||||
ws[key + str(start_index)].style = normal_cell_red
|
ws[key + str(start_index)].style = normal_cell_red
|
||||||
ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00
|
ws[key + str(start_index)].number_format = '0.0'
|
||||||
elif 'average_processing_time' in mapping[key] and type(value) in [int, float]:
|
elif 'average_processing_time' in mapping[key] and type(value) in [int, float]:
|
||||||
if value > 2.0:
|
if value > 2.0:
|
||||||
ws[key + str(start_index)].style = normal_cell_red
|
ws[key + str(start_index)].style = normal_cell_red
|
||||||
ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00
|
ws[key + str(start_index)].number_format = '0.0'
|
||||||
elif 'bad_percent' in mapping[key] and type(value) in [int, float]:
|
elif 'bad_percent' in mapping[key] and type(value) in [int, float]:
|
||||||
if value > 10:
|
if value > 10:
|
||||||
ws[key + str(start_index)].style = normal_cell_red
|
ws[key + str(start_index)].style = normal_cell_red
|
||||||
ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00
|
ws[key + str(start_index)].number_format = '0.0'
|
||||||
elif 'percent' in mapping[key] and type(value) in [int, float]:
|
elif 'percent' in mapping[key] and type(value) in [int, float]:
|
||||||
ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00
|
ws[key + str(start_index)].number_format = '0.0'
|
||||||
else :
|
else :
|
||||||
ws[key + str(start_index)].style = normal_cell
|
ws[key + str(start_index)].style = normal_cell
|
||||||
elif _type == 'report_detail':
|
elif _type == 'report_detail':
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user