FIX: check the imei number array length

This commit is contained in:
daovietanh99 2024-02-22 09:36:45 +07:00
parent 95fb59c80a
commit 3749cf83a8

View File

@ -686,7 +686,13 @@ class AccuracyViewSet(viewsets.ViewSet):
subscription_request_file.reviewed_result = reviewed_result
subscription_request_file.reviewed_result['imei_number'] = []
elif subscription_request_file.doc_type == 'imei':
subscription_request_file.reviewed_result = {"retailername": None, "sold_to_party": None, "purchase_date": [], "imei_number": [reviewed_result["imei_number"][subscription_request_file.index_in_request]]}
subscription_request_file.reviewed_result = {
"retailername": None,
"sold_to_party": None,
"purchase_date": [],
"imei_number": []}
if len(reviewed_result["imei_number"]) - 1 >= subscription_request_file.index_in_request:
subscription_request_file.reviewed_result["imei_number"] = reviewed_result["imei_number"][subscription_request_file.index_in_request]
subscription_request_file.save()
subscription_request.reviewed_result = reviewed_result