[chronojump-server] IMPORTANT: laterality column has been added to resultEncoder model. Comment in tasks has been moved



commit b6fdbc75d69fa995594bfd18200be1fc7d080829
Author: Marcos Venteo <mventeo gmail com>
Date:   Thu Jun 29 13:52:32 2017 +0200

    IMPORTANT: laterality column has been added to resultEncoder model. Comment in tasks has been moved to 
Parametrized tasks and can be saved from there. Some minor changes in stylesheet and some minor fixes.

 chronojumpserver/js/players.js              |   23 ++++++++++++---------
 chronojumpserver/js/results.js              |    5 ++++
 chronojumpserver/models.py                  |    9 +++++--
 chronojumpserver/static/style.css           |    2 +-
 chronojumpserver/templates/player_list.html |   29 ++++++++++++++------------
 5 files changed, 41 insertions(+), 27 deletions(-)
---
diff --git a/chronojumpserver/js/players.js b/chronojumpserver/js/players.js
index dce1da8..2ace0dd 100755
--- a/chronojumpserver/js/players.js
+++ b/chronojumpserver/js/players.js
@@ -159,15 +159,16 @@ $(document).ready(function() {
                             }
                             html += "<li><a class='task-link' "
                             html += "data-task-id='" + task.id + "' "
-                            html += "data-task-type='" + task.type + "'"
-                            html += "data-task-station-id='" + task.stationId + "'"
-                            html += "data-task-exercise-id='" + task.exerciseId + "'"
-                            html += "data-task-sets='" + task.sets + "'"
-                            html += "data-task-nreps='" + task.nreps + "'"
-                            html += "data-task-load='" + task.load + "'"
-                            html += "data-task-speed='" + task.speed + "'"
-                            html += "data-task-percent-max-speed='" + task.percentMaxSpeed + "'"
-                            html += "data-task-laterality='" + task.laterality + "'"
+                            html += "data-task-type='" + task.type + "' "
+                            html += "data-task-station-id='" + task.stationId + "' "
+                            html += "data-task-exercise-id='" + task.exerciseId + "' "
+                            html += "data-task-sets='" + task.sets + "' "
+                            html += "data-task-nreps='" + task.nreps + "' "
+                            html += "data-task-load='" + task.load + "' "
+                            html += "data-task-speed='" + task.speed + "' "
+                            html += "data-task-percent-max-speed='" + task.percentMaxSpeed + "' "
+                            html += "data-task-laterality='" + task.laterality + "' "
+                            html += "data-task-comment='" + task.description + "'"
                             html += ">" + _desc + "</a></li>";
                         });
                         html += "</ol>";
@@ -259,6 +260,7 @@ $(document).ready(function() {
         var taskLaterality = $(this).attr('data-task-laterality');
         var stationId = $(this).attr('data-task-station-id');
         var exerciseId = $(this).attr('data-task-exercise-id');
+        var taskComment = $(this).attr('data-task-comment');
 
         $('#taskParamSelector').removeClass('active');
         $('#taskFreeSelector').removeClass('active');
@@ -273,7 +275,7 @@ $(document).ready(function() {
             // Show the panel for free tasks
             $('#taskFreeSelector').addClass('active');
             $('#freeTask').addClass('active');
-            $('#taskComment').val($(this).text());
+
         }
 
         // Fill the modal
@@ -287,6 +289,7 @@ $(document).ready(function() {
         $('#taskSpeed').val(taskSpeed);
         $('#taskpercentMaxSpeed').val(taskPercentMaxSpeed);
         $('#taskLaterality').val(taskLaterality);
+        $('#taskComment').val(taskComment);
 
         // Hide and show the buttons
         $('#btnDeleteTask').removeClass('hidden').addClass('show');
diff --git a/chronojumpserver/js/results.js b/chronojumpserver/js/results.js
index 948868a..5c894cf 100755
--- a/chronojumpserver/js/results.js
+++ b/chronojumpserver/js/results.js
@@ -108,6 +108,11 @@ $(document).ready(function() {
         title: "Exercici"
       },
       {
+        type: "html",
+        data: "laterality",
+        title: "RL"
+      },
+      {
         type: "num",
         title: "Càrrega",
         data: "resistance",
diff --git a/chronojumpserver/models.py b/chronojumpserver/models.py
index 63d685f..8fcdf8d 100755
--- a/chronojumpserver/models.py
+++ b/chronojumpserver/models.py
@@ -248,7 +248,7 @@ class Task(Base):
             'nreps':       self.nreps,
             'load':        self.load,
             'laterality':  self.laterality,
-            'description': self.comment
+            'description': self.comment.decode('Utf-8')
         }
 
     def add_free_task(self):
@@ -276,6 +276,7 @@ class ResultEncoder(Base):
     station = relationship(Station, primaryjoin=stationId == Station.id)
     exerciseId = Column('exerciseId', ForeignKey('exercise.id'))
     exercise = relationship(Exercise, primaryjoin=exerciseId == Exercise.id)
+    laterality = Column('laterality', String(2))
     resistance = Column('resistance', Float)
     repetitions = Column('repetitions', Integer)
     lossBySpeed = Column('lossBySpeed', Integer)
@@ -295,7 +296,7 @@ class ResultEncoder(Base):
     comments = Column('comments', String(30))
 
     def __init__(self, dt=None, personId=None, stationId=None,
-                 exerciseName="", resistance=0.0, repetitions=0, lossBySpeed=0,
+                 exerciseId=None, laterality='RL', resistance=0.0, repetitions=0, lossBySpeed=0,
                  numBySpeed=0,  rangeBySpeed=0.0,
                  vmeanBySpeed=0.0, vmaxBySpeed=0.0, pmeanBySpeed=0.0,
                  pmaxBySpeed=0.0, lossByPower=0, numByPower=0,
@@ -307,7 +308,8 @@ class ResultEncoder(Base):
         # Rest of values will be assigned directly from params
         self.personId = personId
         self.stationId = stationId
-        self.exerciseName = exerciseName
+        self.exerciseId = exerciseId
+        self.laterality = laterality
         self.resistance = resistance
         self.repetitions = repetitions
         self.lossBySpeed = lossBySpeed
@@ -338,6 +340,7 @@ class ResultEncoder(Base):
             'stationName':  self.station.name,
             'exerciseId':   self.exerciseId,
             'exerciseName': self.exercise.name,
+            'laterality':   self.laterality,
             'resistance':   self.resistance,
             'repetitions':  self.repetitions,
             'lossBySpeed':  self.lossBySpeed,
diff --git a/chronojumpserver/static/style.css b/chronojumpserver/static/style.css
index 05a244e..44289d5 100755
--- a/chronojumpserver/static/style.css
+++ b/chronojumpserver/static/style.css
@@ -61,7 +61,7 @@ body.home {
 }
 
 #results .colResult {
-  color: green;
+  color: blue;
 }
 
 #players td {
diff --git a/chronojumpserver/templates/player_list.html b/chronojumpserver/templates/player_list.html
index f932b05..bbe20db 100755
--- a/chronojumpserver/templates/player_list.html
+++ b/chronojumpserver/templates/player_list.html
@@ -26,7 +26,7 @@
                                <nav class="navbar navbar-default">
                                        <ul class="nav navbar-nav">
                                                <li id="taskParamSelector" role="presentation" 
class="active"><a href="#paramTask" aria-controls="paramTask" role="pill" 
data-toggle="tab">Parametritzada</a></li>
-                                               <li id="taskFreeSelector" role="presentation"><a 
href="#freeTask" aria-controls="freeTask" role="tab" data-toggle="pill">Lliure</a></li>
+                                               <!--<li id="taskFreeSelector" role="presentation"><a 
href="#freeTask" aria-controls="freeTask" role="tab" data-toggle="pill">Lliure</a></li>-->
                                        </ul>
 
                                        <form class="navbar-form navbar-right">
@@ -44,7 +44,7 @@
                                                                </select>
                                                </div>
                                        </form>
-                                       <p class="navbar-text navbar-right">Estació/Excercisi:</p>
+                                       <p class="navbar-text navbar-right">Estació/Excercici:</p>
                                </nav>
 
                                <div class="tab-content">
@@ -52,25 +52,25 @@
 
                                                <form class="form-horizontal" style="margin-top: 10px">
                                                        <div class="form-group">
-                                                               <label for="recipient-name" class="col-sm-2 
control-label"># Series:</label>
+                                                               <label for="numSets" class="col-sm-2 
control-label"># Series:</label>
                                                                <div class="col-sm-2">
                                                                        <input id="numSets" name="numSets" 
type="number" class="form-control" value="1" min="1"></input>
                                                                </div>
-                                                               <label for="recipient-name" 
class="col-sm-offset-4 col-sm-2 control-label"># Repeticions:</label>
+                                                               <label for="numReps" class="col-sm-offset-4 
col-sm-2 control-label"># Repeticions:</label>
                                                                <div class="col-sm-2">
                                                                        <input id="numReps" name="numReps" 
type="number" class="form-control" value="1" min="1"></input>
                                                                </div>
                                                        </div>
                                                        <div class="form-group">
-                                                               <label for="recipient-name" class="col-sm-2 
control-label">Carrega:</label>
+                                                               <label for="taskLoad" class="col-sm-2 
control-label">Carrega:</label>
                                                                <div class="col-sm-2">
                                                                        <input id="taskLoad" name="taskLoad" 
type="number" class="form-control" ></input>
                                                                </div>
-                                                               <label for="recipient-name" class="col-sm-2 
control-label">Velocitat:</label>
+                                                               <label for="taskSpeed" class="col-sm-2 
control-label">Velocitat:</label>
                                                                <div class="col-sm-2">
                                                                        <input id="taskSpeed" 
name="taskSpeed" type="number" class="form-control" min="-1" step="0.1"></input>
                                                                </div>
-                                                               <label for="recipient-name" class="col-sm-2 
control-label">% Vel. Max:</label>
+                                                               <label for="taskpercentMax" class="col-sm-2 
control-label">Vel. Max:</label>
                                                                <div class="col-sm-2">
                                                                        <input id="taskpercentMaxSpeed" 
name="taskpercentMaxSpeed" type="number" class="form-control" ></input>
                                                                </div>
@@ -79,20 +79,23 @@
                                                                <label for="recipient-name" class="col-sm-2 
control-label">Lateralitat:</label>
                                                                <div class="col-sm-10">
                                                                        <select class="form-control" 
id="taskLaterality" name="taskLaterality">
-                                                                               <option value="RL">RL - Ambes 
extremitats</option>
-                                                                               <!--<option value="R,L">R,L - 
Primer amb la dreta, després amb l'esquerra</option>-->
+                                                                               <option value="RL">RL - 
ambdúes extremitats</option>
+                                                                               <option value="R,L">R,L - 
Primer amb la dreta, després amb l'esquerra</option>
                                                                                <option value="R">R - Només 
extremitat dreta</option>
                                                                                <option value="L">L - Només 
extremitat esquerra</option>
                                                                        </select>
                                                                </div>
                                                        </div>
+                                                       <div class="form-group">
+                                                               <label for="taskComment" class="control-label 
col-sm-2">Comentari de l'entrenador:</label>
+                                                               <div class="col-sm-10">
+                                                                       <textarea rows=2 class="form-control" 
id="taskComment"></textarea>
+                                                               </div>
+                                                       </div>
                                                </form>
                                        </div>
                                        <div role="tabpanel" id="freeTask" class="tab-pane">
-                                               <form>
-                                                       <label for="recipient-name" 
class="control-label">Descripció de la tasca:</label>
-                                                       <textarea rows=2 class="form-control" 
id="taskComment"></textarea>
-                                               </form>
+                                               <!-- Disabled panel -->
 
                                        </div>
                                </div>


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