[chronojump-server] getTasks done



commit 50028345c57ff229ba015e3b8e96cc6adc314bbb
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun May 28 21:51:02 2017 +0200

    getTasks done

 main.py |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/main.py b/main.py
index 2b8aa63..c936016 100755
--- a/main.py
+++ b/main.py
@@ -112,6 +112,28 @@ def getPersonByRFID():
     person = cur.fetchall()
 
     return Response(json.dumps(person))
+
+@app.route("/getTasks", methods=['POST'])
+@auto.doc()
+def getTasks():
+    """chronojump client sends person id and not done tasks are returned"""
+    content = request.get_json()
+
+    personId  = content.get('personId', "")
+
+    (con, cur) = connect_db()
+
+    selectStr = "SELECT task.id, task.comment FROM task, person WHERE person.id = \"" + personId + "\" AND 
person.id = task.personId AND done = 0";
+    print(selectStr)
+    cur.execute(selectStr)
+    tasks = cur.fetchall()
+
+#    for task in tasks:
+#        print(task[0])
+#        task[0] = unicode(task[0], errors='replace')
+
+    return Response(json.dumps(tasks))
+
 @app.route("/uploadEncoderData", methods=['POST'])
 @auto.doc()
 def uploadEncoderData():


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]