From aaf8c2b6c29db71a4b85a710aadceccde13fe607 Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Tue, 21 Apr 2020 17:42:20 +0200 Subject: [PATCH] added function for serialization of None, True, False or Inconclusive --- smash/web/api_views/serialization_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/smash/web/api_views/serialization_utils.py b/smash/web/api_views/serialization_utils.py index 5f6cd271..60d4eddc 100644 --- a/smash/web/api_views/serialization_utils.py +++ b/smash/web/api_views/serialization_utils.py @@ -18,6 +18,16 @@ def bool_to_yes_no_null(val): else: return "NO" +def virus_test_to_str(test, date): + if test is None and date is not None: + return "Inconclusive" + if test is None: + return "N/A" + if test: + return "YES" + else: + return "NO" + def flying_team_to_str(flying_team): result = "" -- GitLab