Merge pull request #8 from SDSRV-IDP/vietanh99-request-update
Vietanh99 request update
This commit is contained in:
commit
fbbad38cc8
@ -577,7 +577,14 @@ class RequestViewSet(viewsets.ViewSet):
|
||||
def get_subscription_request(self, request, request_id=None):
|
||||
if request.method == 'GET':
|
||||
base_query = Q(request_id=request_id)
|
||||
subscription_request = SubscriptionRequest.objects.filter(base_query).first()
|
||||
|
||||
subscription_request = SubscriptionRequest.objects.filter(base_query)
|
||||
|
||||
if subscription_request.count() == 0:
|
||||
raise NotFoundException(excArgs=request_id)
|
||||
|
||||
subscription_request = subscription_request.first()
|
||||
|
||||
data = []
|
||||
|
||||
imeis = []
|
||||
@ -601,16 +608,26 @@ class RequestViewSet(viewsets.ViewSet):
|
||||
print(f"[ERROR]: {e}")
|
||||
print(f"[ERROR]: {subscription_request}")
|
||||
data.append({
|
||||
'Document Type': subscription_request.doc_type,
|
||||
'RequestID': subscription_request.request_id,
|
||||
'RedemptionID': subscription_request.redemption_id,
|
||||
'Process Type': subscription_request.process_type,
|
||||
'Provider Code': subscription_request.provider_code,
|
||||
'Status': subscription_request.status,
|
||||
'IMEIs': imeis,
|
||||
'Purchase Date': purchase_date,
|
||||
'Retailer': retailer,
|
||||
'Reviewed result': subscription_request.reviewed_result,
|
||||
'Feedback result': subscription_request.feedback_result,
|
||||
'Is Test Request': subscription_request.is_test_request,
|
||||
'IMEI Accuracy': subscription_request.imei_accuracy,
|
||||
'Purchase Date Accuracy': subscription_request.purchase_date_accuracy,
|
||||
'Retailer Name Accuracy': subscription_request.retailer_name_accuracy,
|
||||
'Sold To Party Accuracy': subscription_request.sold_to_party_accuracy,
|
||||
'Client Request Time (ms)': subscription_request.client_request_time,
|
||||
'Server Processing Time (ms)': subscription_request.preprocessing_time + subscription_request.ai_inference_time,
|
||||
'Is Reviewed': subscription_request.is_reviewed,
|
||||
|
||||
# 'Is Bad Quality': subscription_request.is_bad_image_quality,
|
||||
'created_at': subscription_request.created_at.isoformat(),
|
||||
'updated_at': subscription_request.updated_at.isoformat()
|
||||
@ -627,7 +644,12 @@ class RequestViewSet(viewsets.ViewSet):
|
||||
|
||||
base_query = Q(request_id=request_id)
|
||||
|
||||
subscription_request = SubscriptionRequest.objects.filter(base_query).first()
|
||||
subscription_request = SubscriptionRequest.objects.filter(base_query)
|
||||
|
||||
if subscription_request.count() == 0:
|
||||
raise NotFoundException(excArgs=request_id)
|
||||
|
||||
subscription_request = subscription_request.first()
|
||||
|
||||
reviewed_result = json.loads(data["reviewed_result"])
|
||||
for field in ['retailername', 'sold_to_party', 'purchase_date', 'imei_number']:
|
||||
|
@ -483,7 +483,7 @@ def dict2xlsx(input: json, _type='report'):
|
||||
elif key_index >= 4 and key_index <= 8:
|
||||
ws[key + str(start_index)].fill = fill_yellow
|
||||
elif _type == 'report_detail':
|
||||
if 'accuracy' in mapping[key] and type(value) in [int, float] and value < 95:
|
||||
if 'accuracy' in mapping[key] and type(value) in [int, float] and value < 75:
|
||||
ws[key + str(start_index)].style = normal_cell_red
|
||||
elif 'speed' in mapping[key] and type(value) in [int, float] and value > 2.0:
|
||||
ws[key + str(start_index)].style = normal_cell_red
|
||||
|
Loading…
Reference in New Issue
Block a user