diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-16 12:24:40 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-16 12:24:40 +0100 |
| commit | dabd50f4e625f3c8a1606ca36e380648a01c49a8 (patch) | |
| tree | 2b5787b27afaa54dc54a9b208876bc9b9bccf896 /app | |
| parent | Set default configs to our desired numbers (diff) | |
| download | AnnotateChange-dabd50f4e625f3c8a1606ca36e380648a01c49a8.tar.gz AnnotateChange-dabd50f4e625f3c8a1606ca36e380648a01c49a8.zip | |
Add database column for task assigned by admin
This allows us to later manually assign tasks to users,
which didn't work anymore after the task assignment
rewrite.
Diffstat (limited to 'app')
| -rw-r--r-- | app/admin/routes.py | 1 | ||||
| -rw-r--r-- | app/auth/routes.py | 2 | ||||
| -rw-r--r-- | app/main/routes.py | 2 | ||||
| -rw-r--r-- | app/models.py | 1 |
4 files changed, 5 insertions, 1 deletions
diff --git a/app/admin/routes.py b/app/admin/routes.py index 518b3fc..98eb2fc 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -78,6 +78,7 @@ def manage_tasks(): return redirect(url_for("admin.manage_tasks")) else: task = Task(annotator_id=user.id, dataset_id=dataset.id) + task.admin_assigned = True db.session.add(task) db.session.commit() flash("Task registered successfully.", "success") diff --git a/app/auth/routes.py b/app/auth/routes.py index 0556233..21b1a67 100644 --- a/app/auth/routes.py +++ b/app/auth/routes.py @@ -97,6 +97,8 @@ def login(): annotator_id=current_user.id, done=False ).all() for task in user_tasks: + if task.admin_assigned: + continue anns = Annotation.query.filter_by(task_id=task.id).all() if len(anns) > 0: flash( diff --git a/app/main/routes.py b/app/main/routes.py index 75959a0..8d2aa6e 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -56,7 +56,7 @@ def assign(): user_tasks = [t for t in user_tasks if not t.done] # if the user has, for some reason, a unfinished assigned task, redirect to - # that + # that. This can happen if the admin has assigned this task. if len(user_tasks) > 0: task = user_tasks[0] return redirect(url_for("main.annotate", task_id=task.id)) diff --git a/app/models.py b/app/models.py index 757a0ef..fc6cebd 100644 --- a/app/models.py +++ b/app/models.py @@ -102,6 +102,7 @@ class Task(db.Model): dataset_id = db.Column(db.Integer, nullable=False) done = db.Column(db.Boolean, nullable=False, default=False) annotated_on = db.Column(db.DateTime, nullable=True) + admin_assigned = db.Column(db.Boolean, nullable=False, default=False) user = db.relation("User") annotator_id = db.Column(db.Integer, db.ForeignKey("user.id")) |
