Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for animalCount: 0 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down