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 = {
|
||||
'A': 'subs',
|
||||
'B': 'extraction_date',
|
||||
'C': 'num_imei',
|
||||
'D': 'num_invoice',
|
||||
'E': 'total_images',
|
||||
'F': 'images_quality.successful',
|
||||
'G': 'images_quality.successful_percent',
|
||||
'H': 'images_quality.bad',
|
||||
'I': 'images_quality.bad_percent',
|
||||
'J': 'average_accuracy_rate.imei',
|
||||
'K': 'average_accuracy_rate.purchase_date',
|
||||
'L': 'average_accuracy_rate.retailer_name',
|
||||
'M': 'average_processing_time.imei',
|
||||
'N': 'average_processing_time.invoice',
|
||||
'O': 'usage.imei',
|
||||
'P': 'usage.invoice',
|
||||
'C': 'usage.total_images',
|
||||
'D': 'usage.imei',
|
||||
'E': 'usage.invoice',
|
||||
'F': 'total_images',
|
||||
'G': 'num_imei',
|
||||
'H': 'num_invoice',
|
||||
'I': 'images_quality.successful',
|
||||
'J': 'images_quality.successful_percent',
|
||||
'K': 'images_quality.bad',
|
||||
'L': 'images_quality.bad_percent',
|
||||
'M': 'average_accuracy_rate.imei',
|
||||
'N': 'average_accuracy_rate.purchase_date',
|
||||
'O': 'average_accuracy_rate.retailer_name',
|
||||
'P': 'average_processing_time.imei',
|
||||
'Q': 'average_processing_time.invoice',
|
||||
}
|
||||
start_index = 5
|
||||
|
||||
@ -497,7 +498,7 @@ def dict2xlsx(input: json, _type='report'):
|
||||
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 = 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):
|
||||
ws[key + str(start_index)].fill = fill_gray
|
||||
elif key_index == 1:
|
||||
@ -506,19 +507,19 @@ def dict2xlsx(input: json, _type='report'):
|
||||
ws[key + str(start_index)].fill = fill_yellow
|
||||
else:
|
||||
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)].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]:
|
||||
if value > 2.0:
|
||||
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]:
|
||||
if value > 10:
|
||||
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]:
|
||||
ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00
|
||||
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.
Loading…
Reference in New Issue
Block a user