return None to acc and speed
This commit is contained in:
parent
56a0f1f37c
commit
13eb7ea06c
@ -413,7 +413,10 @@ class AccuracyViewSet(viewsets.ViewSet):
|
||||
for key in acc_keys:
|
||||
fb = report.feedback_accuracy.get(key, 0) if report.feedback_accuracy else 0
|
||||
rv = report.reviewed_accuracy.get(key, 0) if report.reviewed_accuracy else 0
|
||||
acc[key] = report.combined_accuracy.get(key, 0) if report.combined_accuracy else max([fb, rv])
|
||||
if report.report_type not in ["BILLING", "billing"]:
|
||||
acc[key] = report.combined_accuracy.get(key, 0) if report.combined_accuracy else max([fb, rv])
|
||||
else:
|
||||
acc[key] = None
|
||||
data.append({
|
||||
"ID": report.id,
|
||||
"Created Date": report.created_at,
|
||||
|
@ -353,6 +353,22 @@ def create_billing_report(report_id, **kwargs):
|
||||
billing_data = create_billing_data(subscription_requests)
|
||||
report.number_request = len(subscription_requests)
|
||||
report.number_images = len(billing_data)
|
||||
|
||||
acumulated_acc = {"feedback": {},
|
||||
"reviewed": {},
|
||||
"acumulated": {}}
|
||||
for acc_type in ["feedback", "reviewed", "acumulated"]:
|
||||
for key in ["imei_number", "purchase_date", "retailername", "sold_to_party"]:
|
||||
acumulated_acc[acc_type][key] = None
|
||||
acumulated_acc[acc_type][key + "_count"] = None
|
||||
acumulated_acc[acc_type]["avg"] = None
|
||||
|
||||
report.feedback_accuracy = acumulated_acc["feedback"]
|
||||
report.reviewed_accuracy = acumulated_acc["reviewed"]
|
||||
report.combined_accuracy = acumulated_acc["acumulated"]
|
||||
|
||||
report.average_OCR_time = {"invoice": None, "imei": None,
|
||||
"invoice_count": None, "imei_count": None, "avg": None}
|
||||
report.status = "Ready"
|
||||
report.save()
|
||||
data_workbook = dict2xlsx(billing_data, _type='billing_report')
|
||||
|
Loading…
Reference in New Issue
Block a user