diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-13 15:27:46 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-13 15:27:46 +0100 |
| commit | 249f846b883656878b9b98cf0642f103aab7fc04 (patch) | |
| tree | 455137155e29d091edbaf91292db86e01fd19956 /app/main | |
| parent | Assign new tasks on the fly (diff) | |
| download | AnnotateChange-249f846b883656878b9b98cf0642f103aab7fc04.tar.gz AnnotateChange-249f846b883656878b9b98cf0642f103aab7fc04.zip | |
Minor comments
Diffstat (limited to 'app/main')
| -rw-r--r-- | app/main/routes.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/main/routes.py b/app/main/routes.py index 8a0e83e..75959a0 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -72,6 +72,7 @@ def assign(): db.session.commit() return redirect(url_for("main.annotate", task_id=task.id)) + @bp.route("/annotate/<int:task_id>", methods=("GET", "POST")) @login_required def annotate(task_id): @@ -123,22 +124,31 @@ def annotate(task_id): return url_for("main.index") task = Task.query.filter_by(id=task_id).first() + + # check if task exists if task is None: flash("No task with id %r exists." % task_id, "error") return redirect(url_for("main.index")) + + # check if task is assigned to this user if not task.annotator_id == current_user.id: flash( "No task with id %r has been assigned to you." % task_id, "error" ) return redirect(url_for("main.index")) + + # check if task is not already done if task.done: flash("It's not possible to edit annotations at the moment.") return redirect(url_for("main.index")) + data = load_data_for_chart(task.dataset.name, task.dataset.md5sum) if data is None: flash( - "An internal error occurred loading this dataset, the admin has been notified. Please try again later. We apologise for the inconvenience." + "An internal error occurred loading this dataset, the admin has been notified. Please try again later. We apologise for the inconvenience.", + "error", ) + return redirect(url_for("main.index")) title = f"Dataset: {task.dataset.id}" is_multi = len(data["chart_data"]["values"]) > 1 return render_template( |
