Fix: Missleading raw accuracy
This commit is contained in:
parent
98136bcdd7
commit
3ec006dfd0
@ -110,7 +110,7 @@ def create_accuracy_report(report_id, **kwargs):
|
|||||||
if request.status != 200 or not (request.reviewed_result or request.feedback_result):
|
if request.status != 200 or not (request.reviewed_result or request.feedback_result):
|
||||||
# Failed requests or lack of reviewed_result/feedback_result
|
# Failed requests or lack of reviewed_result/feedback_result
|
||||||
continue
|
continue
|
||||||
request_att, _report_files, _att = calculate_a_request(report, request)
|
request_att, _report_files, _atts = calculate_a_request(report, request)
|
||||||
report_files += _report_files
|
report_files += _report_files
|
||||||
report_engine.add(request, _report_files, report)
|
report_engine.add(request, _report_files, report)
|
||||||
request.feedback_accuracy = {"imei_number": mean_list(request_att["acc"]["feedback"].get("imei_number", [None])),
|
request.feedback_accuracy = {"imei_number": mean_list(request_att["acc"]["feedback"].get("imei_number", [None])),
|
||||||
@ -125,10 +125,11 @@ def create_accuracy_report(report_id, **kwargs):
|
|||||||
"invoice_no": mean_list(request_att["acc"]["reviewed"].get("invoice_no", [None]))}
|
"invoice_no": mean_list(request_att["acc"]["reviewed"].get("invoice_no", [None]))}
|
||||||
rq_accuracy = {"feedback": [],
|
rq_accuracy = {"feedback": [],
|
||||||
"reviewed": []}
|
"reviewed": []}
|
||||||
|
|
||||||
for t in _att["acc"].keys():
|
for _att in _atts:
|
||||||
for cl in _att["acc"][t].keys():
|
for t in _att["acc"].keys():
|
||||||
rq_accuracy[t] += _att["acc"][t][cl]
|
for cl in _att["acc"][t].keys():
|
||||||
|
rq_accuracy[t] += _att["acc"][t][cl]
|
||||||
|
|
||||||
# for rpf in _report_files:
|
# for rpf in _report_files:
|
||||||
# for cl in rpf.feedback_accuracy.keys():
|
# for cl in rpf.feedback_accuracy.keys():
|
||||||
|
@ -797,7 +797,7 @@ def calculate_a_request(report, request):
|
|||||||
0: "No",
|
0: "No",
|
||||||
1: "Yes"}
|
1: "Yes"}
|
||||||
return review_status.get(input, "N/A")
|
return review_status.get(input, "N/A")
|
||||||
|
atts = []
|
||||||
request_att = {"acc": {"feedback": {"imei_number": [],
|
request_att = {"acc": {"feedback": {"imei_number": [],
|
||||||
"purchase_date": [],
|
"purchase_date": [],
|
||||||
"retailername": [],
|
"retailername": [],
|
||||||
@ -829,6 +829,7 @@ def calculate_a_request(report, request):
|
|||||||
for image in images:
|
for image in images:
|
||||||
|
|
||||||
status, att = calculate_subcription_file(image)
|
status, att = calculate_subcription_file(image)
|
||||||
|
atts.append(att)
|
||||||
att["acc"]["feedback"], fb_max_indexes = acc_maximize_list_values(att["acc"]["feedback"])
|
att["acc"]["feedback"], fb_max_indexes = acc_maximize_list_values(att["acc"]["feedback"])
|
||||||
att["acc"]["reviewed"], rv_max_indexes = acc_maximize_list_values(att["acc"]["reviewed"])
|
att["acc"]["reviewed"], rv_max_indexes = acc_maximize_list_values(att["acc"]["reviewed"])
|
||||||
|
|
||||||
@ -945,7 +946,7 @@ def calculate_a_request(report, request):
|
|||||||
print(f"[ERROR]: failed to calculate request: {request.request_id} - request_file: {image.file_name} because of {e}")
|
print(f"[ERROR]: failed to calculate request: {request.request_id} - request_file: {image.file_name} because of {e}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return request_att, report_files, att
|
return request_att, report_files, atts
|
||||||
|
|
||||||
def calculate_subcription_file(subcription_request_file):
|
def calculate_subcription_file(subcription_request_file):
|
||||||
att = {"acc": {"feedback": {},
|
att = {"acc": {"feedback": {},
|
||||||
|
Loading…
Reference in New Issue
Block a user