From 069562f1e92d93712ec0f68ef63c276389e22192 Mon Sep 17 00:00:00 2001
From: FSMPI Admin-Team <admin@fsmpi.rwth-aachen.de>
Date: Tue, 7 Mar 2017 20:09:57 +0100
Subject: [PATCH] Send mails correctly

---
 tasks.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tasks.py b/tasks.py
index 95f3b22..650eaa8 100644
--- a/tasks.py
+++ b/tasks.py
@@ -479,8 +479,9 @@ def send_todomails_async(protocol_id):
     with app.app_context():
         protocol = Protocol.query.filter_by(id=protocol_id).first()
         all_todos = [
-            todo for todo in Todo.query.filter.all()
+            todo for todo in Todo.query.all()
             if not todo.is_done()
+            and todo.protocoltype == protocol.protocoltype
         ]
         users = {user for todo in all_todos for user in todo.get_users()}
         grouped_todos = {
-- 
GitLab