Skip to content

Commit

Permalink
assigning zero for null scores
Browse files Browse the repository at this point in the history
  • Loading branch information
abdollahis2 authored and abdollahis2 committed Jan 10, 2024
1 parent 742bbf4 commit 88a2425
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tr_sys/tr_ars/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 88a2425

Please sign in to comment.