From 88a2425fc093ca4b97aa91969576659b03b07fb0 Mon Sep 17 00:00:00 2001 From: abdollahis2 Date: Wed, 10 Jan 2024 11:07:34 -0500 Subject: [PATCH] assigning zero for null scores --- tr_sys/tr_ars/utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tr_sys/tr_ars/utils.py b/tr_sys/tr_ars/utils.py index cf53502e..62c5a3e1 100644 --- a/tr_sys/tr_ars/utils.py +++ b/tr_sys/tr_ars/utils.py @@ -1273,12 +1273,18 @@ def normalizeScores(results): if analysis['score'] is not None: temp_score.append(analysis['score']) else: - logging.error("Analyses score field is null") + logging.error("Analyses score field is null, setting it to zero") + analysis['score']=0 + temp_score.append(analysis['score']) + score = statistics.mean(temp_score) elif len(res['analyses']) == 1: if 'score' in res['analyses'][0]: - score = res['analyses'][0]['score'] + if res['analyses'][0]['score'] is not None: + score = res['analyses'][0]['score'] + else: + score = 0 else: logging.debug('Result doesnt have score field') score = None