From a7b86730aa761ccb08161d19ebe9d9237785f9e3 Mon Sep 17 00:00:00 2001 From: daovietanh99 Date: Thu, 15 Feb 2024 15:21:53 +0700 Subject: [PATCH] UPDATE: update report xlsx and file utils --- cope2n-api/fwd_api/utils/file.py | 41 ++++++++++++++++--------------- cope2n-api/report.xlsx | Bin 6546 -> 6954 bytes 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/cope2n-api/fwd_api/utils/file.py b/cope2n-api/fwd_api/utils/file.py index 4b5e55e..b71604e 100644 --- a/cope2n-api/fwd_api/utils/file.py +++ b/cope2n-api/fwd_api/utils/file.py @@ -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': diff --git a/cope2n-api/report.xlsx b/cope2n-api/report.xlsx index fc5b37d989c90238850317ab48fca2472ee7f76f..a7fa7e2ac06c6812f5f8a86c869885a2fce4a75e 100644 GIT binary patch delta 4963 zcmZu#2Q(b*_ggv6R5QMO5^xjLN6J3N=gJ4IGwMbaKBsvi_t3-$hN%USqgs7`T zi4p|MpYNRC_vQP}|IV2+cg~r)=RWtD`@D1C6!8j4u%XU1JP3%0hzPW=V2})E13u_? ziju|dgv1LT-JVq>DkyEy)okIEU~A{`Vs1bbeT>>WRHdONOMKm#LH#UcLBv`NjvX zRvkB;K=O)Dd~M7EZ=E~EVWKTIfdpzF*Sm#N0A6dfo~OrcFD-VK#|q+$_qb4;kGi#W zi$cqwt<+%WSd!p5=dk9!?>njFjAWvkdQ=&lnC))5v8E(WY--|0oBV4~G}$ z+GSnP`nY1ae>stO_y2NG7y@>{(&%XploI~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