Merge pull request #73 from SDSRV-IDP/trungpt/dev_billing_report
return None to acc and speed
This commit is contained in:
commit
6e4a922d51
@ -413,7 +413,10 @@ class AccuracyViewSet(viewsets.ViewSet):
|
|||||||
for key in acc_keys:
|
for key in acc_keys:
|
||||||
fb = report.feedback_accuracy.get(key, 0) if report.feedback_accuracy else 0
|
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
|
rv = report.reviewed_accuracy.get(key, 0) if report.reviewed_accuracy else 0
|
||||||
|
if report.report_type not in ["BILLING", "billing"]:
|
||||||
acc[key] = report.combined_accuracy.get(key, 0) if report.combined_accuracy else max([fb, rv])
|
acc[key] = report.combined_accuracy.get(key, 0) if report.combined_accuracy else max([fb, rv])
|
||||||
|
else:
|
||||||
|
acc[key] = None
|
||||||
data.append({
|
data.append({
|
||||||
"ID": report.id,
|
"ID": report.id,
|
||||||
"Created Date": report.created_at,
|
"Created Date": report.created_at,
|
||||||
|
@ -353,6 +353,22 @@ def create_billing_report(report_id, **kwargs):
|
|||||||
billing_data = create_billing_data(subscription_requests)
|
billing_data = create_billing_data(subscription_requests)
|
||||||
report.number_request = len(subscription_requests)
|
report.number_request = len(subscription_requests)
|
||||||
report.number_images = len(billing_data)
|
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.status = "Ready"
|
||||||
report.save()
|
report.save()
|
||||||
data_workbook = dict2xlsx(billing_data, _type='billing_report')
|
data_workbook = dict2xlsx(billing_data, _type='billing_report')
|
||||||
|
Loading…
Reference in New Issue
Block a user