From 74ff2a6794ae35c20f0ed60e05497f1b5be4e4ed Mon Sep 17 00:00:00 2001 From: TannedCung Date: Mon, 17 Jun 2024 11:12:24 +0700 Subject: [PATCH] Fix: empty string = None --- cope2n-api/fwd_api/api/accuracy_view.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cope2n-api/fwd_api/api/accuracy_view.py b/cope2n-api/fwd_api/api/accuracy_view.py index 149c9f2..2d5cd85 100755 --- a/cope2n-api/fwd_api/api/accuracy_view.py +++ b/cope2n-api/fwd_api/api/accuracy_view.py @@ -990,7 +990,7 @@ class AccuracyViewSet(viewsets.ViewSet): v = v.split("") if not isinstance(sample_result[k], list): sample_result[k] = v - else: + elif v: sample_result[k].append(v) if subscription_request_file.reviewed_result is not None: @@ -998,8 +998,10 @@ class AccuracyViewSet(viewsets.ViewSet): else: subscription_request_file.reviewed_result = sample_result - subscription_request_file.reason = reason - subscription_request_file.counter_measures = solution + if reason: + subscription_request_file.reason = reason + if solution: + subscription_request_file.counter_measures = solution subscription_request_file.is_reviewed = True subscription_request_file.save() is_available = True