diff --git a/tr_sys/tr_ars/utils.py b/tr_sys/tr_ars/utils.py index b933b7ca..62c5a3e1 100644 --- a/tr_sys/tr_ars/utils.py +++ b/tr_sys/tr_ars/utils.py @@ -1270,12 +1270,21 @@ def normalizeScores(results): temp_score = [] for analysis in res['analyses']: if 'score' in analysis.keys(): - temp_score.append(analysis['score']) + if analysis['score'] is not None: + temp_score.append(analysis['score']) + else: + 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