Merge pull request #138 from SDSRV-IDP/BE/Fix_report_page
Be/fix report page
This commit is contained in:
commit
a710ceeb84
@ -987,7 +987,7 @@ class AccuracyViewSet(viewsets.ViewSet):
|
|||||||
if isinstance(v, str) and v == '':
|
if isinstance(v, str) and v == '':
|
||||||
v = None
|
v = None
|
||||||
if k == "purchase_date" and v is not None:
|
if k == "purchase_date" and v is not None:
|
||||||
v = v.split("")
|
v = v.split(",")
|
||||||
if not isinstance(sample_result[k], list):
|
if not isinstance(sample_result[k], list):
|
||||||
sample_result[k] = v
|
sample_result[k] = v
|
||||||
elif v:
|
elif v:
|
||||||
|
@ -12,6 +12,7 @@ from ..utils.redis import RedisUtils
|
|||||||
from ..utils.cache import set_cache, get_cache
|
from ..utils.cache import set_cache, get_cache
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
from itertools import chain
|
||||||
import json
|
import json
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
@ -123,20 +124,17 @@ def create_accuracy_report(report_id, **kwargs):
|
|||||||
"retailername": mean_list(request_att["acc"]["reviewed"].get("retailername", [None])),
|
"retailername": mean_list(request_att["acc"]["reviewed"].get("retailername", [None])),
|
||||||
"sold_to_party": mean_list(request_att["acc"]["reviewed"].get("sold_to_party", [None])),
|
"sold_to_party": mean_list(request_att["acc"]["reviewed"].get("sold_to_party", [None])),
|
||||||
"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 = []
|
||||||
"reviewed": []}
|
|
||||||
|
|
||||||
for rpf in _report_files:
|
for rpf in _report_files:
|
||||||
for cl in rpf.feedback_accuracy.keys():
|
if sum(len(value_list) for value_list in rpf.reviewed_accuracy.values()):
|
||||||
rq_accuracy["feedback"] += rpf.feedback_accuracy[cl]
|
rq_accuracy += list(chain(*rpf.reviewed_accuracy.values()))
|
||||||
for cl in rpf.reviewed_accuracy.keys():
|
elif sum(len(value_list) for value_list in rpf.feedback_accuracy.values()):
|
||||||
rq_accuracy["reviewed"] += rpf.reviewed_accuracy[cl]
|
rq_accuracy += list(chain(*rpf.feedback_accuracy.values()))
|
||||||
|
|
||||||
request.is_required = False
|
request.is_required = False
|
||||||
if len(rq_accuracy["reviewed"]) > 0:
|
if len(rq_accuracy) > 0:
|
||||||
request.raw_accuracy = mean_list(rq_accuracy["reviewed"])
|
request.raw_accuracy = mean_list(rq_accuracy)
|
||||||
elif len(rq_accuracy["feedback"]) > 0:
|
|
||||||
request.raw_accuracy = mean_list(rq_accuracy["feedback"])
|
|
||||||
request.is_required = request.raw_accuracy < settings.NEED_REVIEW if isinstance(request.raw_accuracy, float) else False # No need to review by default
|
request.is_required = request.raw_accuracy < settings.NEED_REVIEW if isinstance(request.raw_accuracy, float) else False # No need to review by default
|
||||||
|
|
||||||
request.save()
|
request.save()
|
||||||
|
Loading…
Reference in New Issue
Block a user