aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-09-05 12:41:47 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-09-05 12:41:47 +0100
commit13d212d740963935976dcf99a4c8fc96093967be (patch)
tree94319d237a00a63bedd858b7310d207073df0b89 /app
parentShow dataset name for admin (diff)
downloadAnnotateChange-13d212d740963935976dcf99a4c8fc96093967be.tar.gz
AnnotateChange-13d212d740963935976dcf99a4c8fc96093967be.zip
Don't assign task to user that has unfinished tasks
Diffstat (limited to 'app')
-rw-r--r--app/utils/tasks.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/utils/tasks.py b/app/utils/tasks.py
index 5629d46..2bf49ad 100644
--- a/app/utils/tasks.py
+++ b/app/utils/tasks.py
@@ -27,6 +27,13 @@ def generate_user_task(user):
user_tasks = Task.query.filter_by(annotator_id=user.id).all()
user_tasks = [t for t in user_tasks if not t.dataset.is_demo]
+
+ # don't assign a new task if the user has assigned tasks
+ not_done = [t for t in user_tasks if not t.done]
+ if len(not_done) > 0:
+ return None
+
+ # don't assign a new task if the user has reached maximum
n_user_tasks = len(user_tasks)
if n_user_tasks >= max_per_user:
return None