doc_type to be "only_include"
This commit is contained in:
parent
cdfdb0c25b
commit
40cd3189ac
@ -245,6 +245,7 @@ FIELDS_BY_SUB = {
|
|||||||
BAD_THRESHOLD = 0.75
|
BAD_THRESHOLD = 0.75
|
||||||
NEED_REVIEW = 1.0
|
NEED_REVIEW = 1.0
|
||||||
|
|
||||||
|
DOC_TYPES = ["imei", "invoice"]
|
||||||
SUB_FOR_BILLING = ["all", "seao"]
|
SUB_FOR_BILLING = ["all", "seao"]
|
||||||
FIELD = ["imei_number", "purchase_date", "retailername", "sold_to_party", "invoice_no"]
|
FIELD = ["imei_number", "purchase_date", "retailername", "sold_to_party", "invoice_no"]
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ class AccuracyViewSet(viewsets.ViewSet):
|
|||||||
description='Which subsidiary to be included',
|
description='Which subsidiary to be included',
|
||||||
type=OpenApiTypes.STR,
|
type=OpenApiTypes.STR,
|
||||||
enum=list(settings.SUBS.keys()),
|
enum=list(settings.SUBS.keys()),
|
||||||
|
required=True
|
||||||
),
|
),
|
||||||
OpenApiParameter(
|
OpenApiParameter(
|
||||||
name='request_id',
|
name='request_id',
|
||||||
@ -138,6 +139,7 @@ class AccuracyViewSet(viewsets.ViewSet):
|
|||||||
location=OpenApiParameter.QUERY,
|
location=OpenApiParameter.QUERY,
|
||||||
description='Filter by document type',
|
description='Filter by document type',
|
||||||
type=OpenApiTypes.STR,
|
type=OpenApiTypes.STR,
|
||||||
|
enum=list(settings.DOC_TYPES.keys()),
|
||||||
required=False
|
required=False
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -231,7 +233,10 @@ class AccuracyViewSet(viewsets.ViewSet):
|
|||||||
if reviewed_result:
|
if reviewed_result:
|
||||||
base_query &= Q(reviewed_result__icontains=reviewed_result)
|
base_query &= Q(reviewed_result__icontains=reviewed_result)
|
||||||
if doc_type:
|
if doc_type:
|
||||||
base_query &= Q(doc_type__icontains=doc_type)
|
if doc_type.lower() == 'invoice':
|
||||||
|
base_query &= Q(doc_type__regex=r'^invoice(,\s*invoice)*$')
|
||||||
|
elif doc_type.lower() == 'imei':
|
||||||
|
base_query &= Q(doc_type__regex=r'^imei(,\s*imei)*$')
|
||||||
|
|
||||||
if isinstance(max_accuracy, float):
|
if isinstance(max_accuracy, float):
|
||||||
base_query &= Q(raw_accuracy__lt=(
|
base_query &= Q(raw_accuracy__lt=(
|
||||||
|
Loading…
Reference in New Issue
Block a user