fix minor bug
This commit is contained in:
parent
8030ba0e3d
commit
7cb21817ed
@ -536,6 +536,10 @@ def first_of_list(the_list):
|
||||
return the_list[0]
|
||||
|
||||
def _feedback_invoice_no_exist(feedback_result):
|
||||
if feedback_result is None:
|
||||
return True
|
||||
if not isinstance(feedback_result, dict):
|
||||
return True
|
||||
invoice_no = feedback_result.get("invoice_no", None)
|
||||
if invoice_no in ["", [], None]:
|
||||
return False
|
||||
@ -700,8 +704,7 @@ def calculate_accuracy(key_name: str, inference: Dict[str, Union[str, List]], ta
|
||||
_inference = inference[key_name]
|
||||
_target = target[key_name]
|
||||
_will_acc_be_ignored = _acc_will_be_ignored(key_name, _target, type)
|
||||
_inference = _accuracy_calculate_formatter(_inference)
|
||||
_target = _accuracy_calculate_formatter(_target)
|
||||
_inference, _target = _accuracy_calculate_formatter(_inference, _target)
|
||||
|
||||
for i, v in enumerate(_inference):
|
||||
# TODO: target[i] is None, ""
|
||||
@ -860,16 +863,15 @@ def calculate_a_request(report, request):
|
||||
image.reviewed_result["purchase_date"] = att["normalized_data"]["reviewed"]["purchase_date"][rv_max_indexes["purchase_date"]][1]
|
||||
request_att["is_reviewed"].append(att["is_reviewed"])
|
||||
|
||||
if att["is_reviewed"] == -1: # -1 means "not required"
|
||||
if att["is_reviewed"] !=1:
|
||||
att["acc"]["reviewed"] = {}
|
||||
reviewed_result = {}
|
||||
reason = None
|
||||
counter_measure = None
|
||||
else:
|
||||
if att["is_reviewed"] == 1:
|
||||
reviewed_result = image.reviewed_result
|
||||
reason = image.reason
|
||||
counter_measure = image.counter_measures
|
||||
reviewed_result = image.reviewed_result
|
||||
reason = image.reason
|
||||
counter_measure = image.counter_measures
|
||||
|
||||
new_report_file = ReportFile(report=report,
|
||||
subsidiary=_sub,
|
||||
@ -935,7 +937,7 @@ def calculate_a_request(report, request):
|
||||
except Exception as e:
|
||||
print(f"[ERROR]: failed to calculate request: {request.request_id} - request_file: {image.file_name} because of {e}")
|
||||
continue
|
||||
|
||||
|
||||
return request_att, report_files
|
||||
|
||||
def calculate_subcription_file(subcription_request_file):
|
||||
|
Loading…
Reference in New Issue
Block a user