From b92cac0254c1014f4873343c38fc5b6ccbe3337d Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Thu, 5 Sep 2019 13:16:52 +0100 Subject: Email the annotation record as a backup --- app/main/routes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/main/routes.py') diff --git a/app/main/routes.py b/app/main/routes.py index 85e8144..b961b60 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -9,6 +9,7 @@ from flask_login import current_user from app import db from app.decorators import login_required from app.main import bp +from app.main.email import send_annotation_backup from app.models import Annotation, Task from app.utils.datasets import load_data_for_chart from app.utils.tasks import generate_user_task @@ -84,6 +85,15 @@ def annotate(task_id): db.session.commit() flash("Your annotation has been recorded, thank you!", "success") + # send the annotation as email to the admin for backup + record = { + "user_id": task.annotator_id, + "dataset_id": task.dataset_id, + "task_id": task.id, + "annotations_raw": annotation, + } + send_annotation_backup(record) + # assign a new task if necessary task = generate_user_task(current_user) if task is None: -- cgit v1.2.3