aboutsummaryrefslogtreecommitdiff
path: root/app/main/routes.py
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-09-05 13:16:52 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-09-05 13:16:52 +0100
commitb92cac0254c1014f4873343c38fc5b6ccbe3337d (patch)
treea4cac96ac91a5b60900aa6b790a2685c29044918 /app/main/routes.py
parentChange percentage to percentage of target (diff)
downloadAnnotateChange-b92cac0254c1014f4873343c38fc5b6ccbe3337d.tar.gz
AnnotateChange-b92cac0254c1014f4873343c38fc5b6ccbe3337d.zip
Email the annotation record as a backup
Diffstat (limited to 'app/main/routes.py')
-rw-r--r--app/main/routes.py10
1 files changed, 10 insertions, 0 deletions
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: