aboutsummaryrefslogtreecommitdiff
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
parentvisuals (diff)
downloadAnnotateChange-df42a47ea20ec14a5716b5b23d4595239a260114.tar.gz
AnnotateChange-df42a47ea20ec14a5716b5b23d4595239a260114.zip
add task overview to user landing page
-rw-r--r--app/main/routes.py11
-rw-r--r--app/templates/index.html44
2 files changed, 44 insertions, 11 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")
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 %}
-<span>Hi, {{ current_user.username }}!</span>
-{% else %}
-<article>
- <div>
- Welcome to <i>AnnotateChange</i> a tool for annotating time
- series data for changepoint analysis.
- <br>
- <br>
- Please log in or register to get started.
+ <h1>Hi, {{ current_user.username }}!</h1>
+ <br>
+ Below are the annotation tasks we've asked you to do, thank you so much for
+ your help!
+ <br>
+ {% if tasks_todo %}
+ <h2>Annotations to be done</h2>
+ <div class="tasks-todo">
+ <ol>
+ {% for task in tasks_todo %}
+ <li><a href="/annotate/{{ task.dataset.id }}">{{ task.dataset.name }}</a></li>
+ {% endfor %}
+ </ol>
+ </div>
+ {% else %}
+ <span>No more tasks to do, thank you!</span>
+ {% endif %}
+ {% if tasks_done %}
+ <h2>Completed Annotations</h2>
+ <div class="tasks-done">
+ {% for task in tasks_done %}
+ <a class="task-done" href="/annotate/{{ task.dataset.id }}">{{ task.dataset.name }}</a>
+ {% endfor %}
</div>
-</article>
+ {% endif %}
+{% else %}
+ <article>
+ <div>
+ Welcome to <i>AnnotateChange</i> a tool for annotating time
+ series data for changepoint analysis.
+ <br>
+ <br>
+ Please log in or register to get started.
+ </div>
+ </article>
{% endif %}
{% endblock %}