[chronojump-server] Use repetitions, lossBySpeed, lossByPower



commit d9a173221138c62472f77a839f83c14441fee1b7
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu May 18 13:53:26 2017 +0200

    Use repetitions, lossBySpeed, lossByPower

 chronojump-flask/chronojump_server.py   |    8 ++++----
 chronojump-flask/templates/results.html |   14 +++++++-------
 main.py                                 |   20 ++++++++++++--------
 tables.txt                              |   18 +++++++++---------
 4 files changed, 32 insertions(+), 28 deletions(-)
---
diff --git a/chronojump-flask/chronojump_server.py b/chronojump-flask/chronojump_server.py
index 6a6418c..5d873a6 100644
--- a/chronojump-flask/chronojump_server.py
+++ b/chronojump-flask/chronojump_server.py
@@ -55,12 +55,12 @@ def Results():
     bySpeed = True
     repetitonString = ""
     if bySpeed:
-        repString = "numBySpeed, rangeBySpeed, vmeanBySpeed, vmaxBySpeed, pmeanBySpeed, pmaxBySpeed";
+        repString = "lossBySpeed, numBySpeed, rangeBySpeed, vmeanBySpeed, vmaxBySpeed, pmeanBySpeed, 
pmaxBySpeed";
     else:
-        repString = "numByPower, rangeByPower, vmeanByPower, vmaxByPower, pmeanByPower, pmaxByPower";
+        repString = "lossByPower, numBySpeed, rangeByPower, vmeanByPower, vmaxByPower, pmeanByPower, 
pmaxByPower";
 
-    cursor.execute("SELECT results.dt, person.name, station.name, results.resistance, results.exerciseName, 
" +
-            repString + ", comments" +
+    cursor.execute("SELECT results.dt, person.name, station.name, " +
+            " results.exerciseName, results.resistance, results.repetitions, " + repString + ", comments" +
             " FROM results, person, station " +
             " WHERE results.personId = person.id " +
             " AND results.stationId = station.id " +
diff --git a/chronojump-flask/templates/results.html b/chronojump-flask/templates/results.html
index 6976295..a8ac1ad 100644
--- a/chronojump-flask/templates/results.html
+++ b/chronojump-flask/templates/results.html
@@ -128,15 +128,17 @@
                                {% if sId == "All" %}
                                        <th>Estació</th>
                                {% endif %}
-                               <th>Càrrega</th>
                                <th>Exercici</th>
-                               <th>[&nbsp;num</th>
+                               <th>Càrrega</th>
+                               <th>n</th>
+                               <th>Pèrdua</th>
+                               <th>[&nbsp;rep</th>
                                <th>rang</th>
                                <th>Vm</th>
                                <th>VM</th>
                                <th>Pm</th>
                                <th>PM&nbsp;]</th>
-                               <th>Comentaris</th>
+                               <!--<th>Comentaris</th>-->
                        </thead>
 
                        {% for row in results %}
@@ -150,10 +152,6 @@
                                {% endif %}
                                <td>{{row[3]}}</td>
                                <td>{{row[4]}}</td>
-                               <!--
-                               <td>{{ row[5] if row[5] != None }}</td>
-                               <td>{{ row[6] if row[6] != None }}</td>
-                               -->
                                <td>{{row[5]}}</td>
                                <td>{{row[6]}}</td>
                                <td>{{row[7]}}</td>
@@ -161,6 +159,8 @@
                                <td>{{row[9]}}</td>
                                <td>{{row[10]}}</td>
                                <td>{{row[11]}}</td>
+                               <td>{{row[12]}}</td>
+                               <!--<td>{{row[13]}}</td>-->
                        </tr>
                        {% endfor %}
                </table>
diff --git a/main.py b/main.py
index f814ca1..65ebf87 100755
--- a/main.py
+++ b/main.py
@@ -104,9 +104,12 @@ def uploadEncoderData():
 
     personId  = content.get('personId', 1)
     stationId  = content.get('stationId', 1)
-    resistance  = content.get('resistance', 0)
     exerciseName  = content.get('exerciseName', "unknown")
+    resistance  = content.get('resistance', 0)
+
+    repetitions = content.get('repetitions', 1)
 
+    lossBySpeed = content.get('lossBySpeed', 0)
     numBySpeed = content.get('numBySpeed', 1)
     rangeBySpeed = content.get('rangeBySpeed', 0)
     vmeanBySpeed = content.get('vmeanBySpeed', 0)
@@ -114,6 +117,7 @@ def uploadEncoderData():
     pmeanBySpeed = content.get('pmeanBySpeed', 0)
     pmaxBySpeed = content.get('pmaxBySpeed', 0)
 
+    lossByPower = content.get('lossByPower', 0)
     numByPower = content.get('numByPower', 1)
     rangeByPower = content.get('rangeByPower', 0)
     vmeanByPower = content.get('vmeanByPower', 0)
@@ -129,13 +133,13 @@ def uploadEncoderData():
     (con, cur) = connect_db()
 
     cur.execute("INSERT INTO results " +
-            "(personId, stationId, resistance, exerciseName, " +
-            "numBySpeed, rangeBySpeed, vmeanBySpeed, vmaxBySpeed, pmeanBySpeed, pmaxBySpeed, " +
-            "numByPower, rangeByPower, vmeanByPower, vmaxByPower, pmeanByPower, pmaxByPower) " +
-            "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
-            (personId, stationId, resistance, exerciseName,
-                numBySpeed, rangeBySpeed, vmeanBySpeed, vmaxBySpeed, pmeanBySpeed, pmaxBySpeed,
-                numByPower, rangeByPower, vmeanByPower, vmaxByPower, pmeanByPower, pmaxByPower,
+            "(personId, stationId, exerciseName, resistance, repetitions, " +
+            "lossBySpeed, numBySpeed, rangeBySpeed, vmeanBySpeed, vmaxBySpeed, pmeanBySpeed, pmaxBySpeed, " +
+            "lossByPower, numByPower, rangeByPower, vmeanByPower, vmaxByPower, pmeanByPower, pmaxByPower) " +
+            "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
+            (personId, stationId, exerciseName, resistance, repetitions,
+                lossBySpeed, numBySpeed, rangeBySpeed, vmeanBySpeed, vmaxBySpeed, pmeanBySpeed, pmaxBySpeed,
+                lossByPower, numByPower, rangeByPower, vmeanByPower, vmaxByPower, pmeanByPower, pmaxByPower,
                 ))
     con.commit()
 
diff --git a/tables.txt b/tables.txt
index 6d2e25d..88080e1 100644
--- a/tables.txt
+++ b/tables.txt
@@ -4,9 +4,9 @@ create database chronojump;
 use chronojump;
 
 CREATE TABLE results (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-               personId INT, stationId INT, resistance FLOAT, exerciseName CHAR(30),
-               numBySpeed FLOAT, rangeBySpeed FLOAT, vmeanBySpeed FLOAT, vmaxBySpeed FLOAT, pmeanBySpeed 
FLOAT, pmaxBySpeed FLOAT,
-               numByPower FLOAT, rangeByPower FLOAT, vmeanByPower FLOAT, vmaxByPower FLOAT, pmeanByPower 
FLOAT, pmaxByPower FLOAT,
+               personId INT, stationId INT, exerciseName CHAR(30), resistance FLOAT, repetitions INT,
+               lossBySpeed INT, numBySpeed INT, rangeBySpeed FLOAT, vmeanBySpeed FLOAT, vmaxBySpeed FLOAT, 
pmeanBySpeed FLOAT, pmaxBySpeed FLOAT,
+               lossByPower INT, numByPower INT, rangeByPower FLOAT, vmeanByPower FLOAT, vmaxByPower FLOAT, 
pmeanByPower FLOAT, pmaxByPower FLOAT,
                comments CHAR(20));
 
 CREATE TABLE station(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name CHAR(30));
@@ -34,13 +34,13 @@ INSERT INTO station VALUES(9, "Leg press");
 INSERT INTO person VALUES(NULL, "joan", 80, 175.7, "212,212,212,212", "");
 INSERT INTO person VALUES(NULL, "pep", 72, 164.4, "211,211,211,211", "");
 
-INSERT INTO results VALUES(NULL, NULL, 1, 2, 45.2, "press de banca",
-               3, 60, 1.5, 2.1, 600.2, 800.3,
-               4, 62, 1.4, 1.9, 620.4, 810.5,
+INSERT INTO results VALUES(NULL, NULL, 1, 2, "press de banca", 45.2, 8,
+               20, 3, 60, 1.5, 2.1, 600.2, 800.3,
+               22, 4, 62, 1.4, 1.9, 620.4, 810.5,
                "");
-INSERT INTO results VALUES(NULL, NULL, 1, 2, 45.2, "press de banca",
-               2, 61, 1.6, 2.2, 500.2, 770.3,
-               1, 64, 1.5, 2.0, 520.4, 790.5,
+INSERT INTO results VALUES(NULL, NULL, 1, 2, "press de banca", 45.2 , 9,
+               15, 2, 61, 1.6, 2.2, 500.2, 770.3,
+               16, 1, 64, 1.5, 2.0, 520.4, 790.5,
                "");
 #INSERT INTO results VALUES(NULL, NULL, 1, 1, 2, "sprint", NULL, NULL, "5 segons");
 


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