[chronojump-server] Added uploadSprintData



commit 0d48cda720a0bd0959924f4a8b5a5cced537a681
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jul 5 18:37:13 2017 +0200

    Added uploadSprintData

 main.py |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/main.py b/main.py
index 4e4b2af..ded4b45 100755
--- a/main.py
+++ b/main.py
@@ -191,6 +191,31 @@ def getEncoderExercise():
     else:
         return Response("", 202)
 
+@app.route("/uploadSprintData", methods=['POST'])
+@auto.doc()
+def uploadSprintData():
+    """chronojump client sends sprint data"""
+    content = request.get_json()
+
+    personId  = content.get('personId', 1)
+    distances  = content.get('distances', "")
+    times  = content.get('times', "")
+
+    #don't need, done on C#
+    #meanPowerBestRep = str(meanPowerBestRep).replace(',', '.')
+
+    ip = request.remote_addr
+
+    (con, cur) = connect_db()
+
+    cur.execute("INSERT INTO resultSprint " +
+            "(dt, personId, distances, times) " +
+            "VALUES (%s, %s, %s, %s)",
+            (datetime.datetime.now(), personId, distances, times))
+    con.commit()
+
+    return Response("", 202)
+
 @app.route("/uploadEncoderData", methods=['POST'])
 @auto.doc()
 def uploadEncoderData():


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