From fb4afa744626df37b51a7d2ef39345171ca6737b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lombra=C3=B1a=20Gonz=C3=A1lez?= Date: Fri, 6 Jul 2018 16:32:17 +0200 Subject: [PATCH] Check for animalCount: 0 --- analysis.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/analysis.py b/analysis.py index b78b16b..d07a287 100644 --- a/analysis.py +++ b/analysis.py @@ -72,7 +72,8 @@ def give_badges(e, t, answers, result): for tr in e.task_runs[t.id]: if tr.user_id: if (len(tr.info['answer']) == 1 and - tr.info['answer'][0]['animalCount'] == -1): + tr.info['answer'][0]['animalCount'] == -1 or + tr.info['answer'][0]['animalCount'] == 0): user_answer = [] else: user_answer = list(filter(lambda x: x['speciesScientificName'] @@ -207,7 +208,7 @@ def basic(**kwargs): if len(e.task_runs[t.id]) == 5: msg = "The five taskruns reported no animal" if type(vc) == pd.Series and ((str(vc.index[0]) == 'nan' or - vc.index[0] == -1) and vc.values[0] == 5): + vc.index[0] == -1 or vc.index[0] == 0) and vc.values[0] == 5): result = enki.pbclient.find_results(project_id=kwargs['project_id'], id=kwargs['result_id'],all=1) if len(result) > 0: @@ -218,7 +219,7 @@ def basic(**kwargs): task.state = 'ongoing' return enki.pbclient.update_task(task) else: - if (str(vc.index[0]) == 'nan' or vc.index[0] == -1) and vc.values[0] >= 10: + if (str(vc.index[0]) == 'nan' or vc.index[0] == -1 or vc.index[0] == 0) and (vc.values[0] >= 10 or vc.values[0] == len(e.task_runs[t.id])) : msg = "10 taskruns reported no animal" result = enki.pbclient.find_results(project_id=kwargs['project_id'], id=kwargs['result_id'],all=1)