From 6b71e095cf99a78c23bd3160db9b17475e9d2801 Mon Sep 17 00:00:00 2001
From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de>
Date: Fri, 14 Apr 2017 01:26:58 +0200
Subject: [PATCH] Show just the todos belonging to the current user

If there are todos which have todo.who == current_user.username, show
only them, as there may be quite a lot of open todos in total.

/close #90
---
 server.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server.py b/server.py
index f8a183a..18832d4 100755
--- a/server.py
+++ b/server.py
@@ -175,6 +175,12 @@ def index():
             if todo.protocoltype.has_private_view_right(user)
             and not todo.is_done()
         ]
+        user_todos = [
+            todo for todo in todos
+            if user.username.lower() in list(map(str.strip, todo.who.lower().split(",")))
+        ]
+        if len(user_todos) > 0:
+            todos = user_todos
         def _todo_sort_key(todo):
             protocol = todo.get_first_protocol()
             return protocol.date if protocol is not None and protocol.date is not None else datetime.now().date()
-- 
GitLab