From df42a47ea20ec14a5716b5b23d4595239a260114 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Tue, 19 Mar 2019 16:19:00 +0000 Subject: add task overview to user landing page --- app/main/routes.py | 11 ++++++++++- app/templates/index.html | 44 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 11 deletions(-) (limited to 'app') 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") diff --git a/app/templates/index.html b/app/templates/index.html index 8ac96eb..e1071d2 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -2,16 +2,40 @@ {% block app_content %} {% if current_user.is_authenticated %} -Hi, {{ current_user.username }}! -{% else %} -
-
- Welcome to AnnotateChange a tool for annotating time - series data for changepoint analysis. -
-
- Please log in or register to get started. +

Hi, {{ current_user.username }}!

+
+ Below are the annotation tasks we've asked you to do, thank you so much for + your help! +
+ {% if tasks_todo %} +

Annotations to be done

+
+
    + {% for task in tasks_todo %} +
  1. {{ task.dataset.name }}
  2. + {% endfor %} +
+
+ {% else %} + No more tasks to do, thank you! + {% endif %} + {% if tasks_done %} +

Completed Annotations

+
+ {% for task in tasks_done %} + {{ task.dataset.name }} + {% endfor %}
-
+ {% endif %} +{% else %} +
+
+ Welcome to AnnotateChange a tool for annotating time + series data for changepoint analysis. +
+
+ Please log in or register to get started. +
+
{% endif %} {% endblock %} -- cgit v1.2.3