aboutsummaryrefslogtreecommitdiff
path: root/app/main
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-19 16:19:00 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-19 16:19:00 +0000
commitdf42a47ea20ec14a5716b5b23d4595239a260114 (patch)
treef8d833b317942630ea7c42c2ee8c6a4b5d55a954 /app/main
parentvisuals (diff)
downloadAnnotateChange-df42a47ea20ec14a5716b5b23d4595239a260114.tar.gz
AnnotateChange-df42a47ea20ec14a5716b5b23d4595239a260114.zip
add task overview to user landing page
Diffstat (limited to 'app/main')
-rw-r--r--app/main/routes.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/main/routes.py b/app/main/routes.py
index e69282c..662e14a 100644
--- a/app/main/routes.py
+++ b/app/main/routes.py
@@ -1,11 +1,20 @@
# -*- coding: utf-8 -*-
from flask import render_template
-from flask_login import login_required
+from flask_login import current_user
from app.main import bp
+from app.models import Task
+
@bp.route("/")
@bp.route("/index")
def index():
+ if current_user.is_authenticated:
+ user_id = current_user.id
+ tasks = Task.query.filter_by(annotator_id=user_id).all()
+ tasks_done = [t for t in tasks if t.done]
+ tasks_todo = [t for t in tasks if not t.done]
+ return render_template("index.html", title="Home",
+ tasks_done=tasks_done, tasks_todo=tasks_todo)
return render_template("index.html", title="Home")