aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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