[chronojump-server] Some fixes



commit e7dcb4ef8844d3ca1b0f3930e6c15bb5dc408e45
Author: Marcos Venteo García <mventeo gmail com>
Date:   Wed Jun 28 23:11:45 2017 +0200

    Some fixes

 chronojumpserver/api.py                     |    2 +-
 chronojumpserver/js/players.js              |    7 ++++---
 chronojumpserver/models.py                  |    2 +-
 chronojumpserver/templates/player_list.html |    4 +---
 chronojumpserver/views.py                   |    2 +-
 5 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/chronojumpserver/api.py b/chronojumpserver/api.py
index fafabc7..8327adb 100755
--- a/chronojumpserver/api.py
+++ b/chronojumpserver/api.py
@@ -161,7 +161,7 @@ def add_modify_delete_task():
                 'speed': speed,
                 'percentMaxSpeed': percentMaxSpeed,
                 'laterality': laterality,
-                'comment': description
+                'comment': description.replace('{', '').replace('}', '')
             })
             db_session.commit()
     elif request.method == "DELETE":
diff --git a/chronojumpserver/js/players.js b/chronojumpserver/js/players.js
index a373666..dce1da8 100755
--- a/chronojumpserver/js/players.js
+++ b/chronojumpserver/js/players.js
@@ -225,14 +225,14 @@ $(document).ready(function() {
         $('#playerId').val(player.id);
         $('#taskId').val('-1');
         // Modal is empty
-        $('#stationSelect').val('');
+        $("#stationSelect").val($("#stationSelect option:first").val());
         refreshExercises(null);
         $('#numSets').val(-1);
         $('#numReps').val(-1);
         $('#taskLoad').val(-1);
         $('#taskSpeed').val(-1);
         $('#taskpercentMaxSpeed').val(-1);
-        $('#taskLaterality').val('');
+        $('#taskLaterality').val($("#taskLaterality option:first").val());
         $('#taskComment').val('');
         $('#taskParamSelector').removeClass('active');
         $('#taskFreeSelector').removeClass('active');
@@ -248,7 +248,7 @@ $(document).ready(function() {
     /* To show the model to modify the task */
     $('#players').on('click', 'a.task-link', function() {
         var player = table.row($(this).parents('tr')).data();
-        $('#taskComment').val($(this).text());
+
         $('#modal-title').text('Modificar tasca #' + $(this).attr('data-task-id') + ' per ' + player.name);
         var taskType = $(this).attr('data-task-type');
         var taskSets = $(this).attr('data-task-sets');
@@ -273,6 +273,7 @@ $(document).ready(function() {
             // Show the panel for free tasks
             $('#taskFreeSelector').addClass('active');
             $('#freeTask').addClass('active');
+            $('#taskComment').val($(this).text());
         }
 
         // Fill the modal
diff --git a/chronojumpserver/models.py b/chronojumpserver/models.py
index ef827d7..63d685f 100755
--- a/chronojumpserver/models.py
+++ b/chronojumpserver/models.py
@@ -231,7 +231,7 @@ class Task(Base):
         self.percentMaxSpeed = percentMaxSpeed
         self.laterality = laterality
         self.done = done
-        self.comment = comment
+        self.comment = comment.replace('{', '').replace('}', '')
 
     @property
     def serialize(self):
diff --git a/chronojumpserver/templates/player_list.html b/chronojumpserver/templates/player_list.html
index 75a91c5..478a15d 100755
--- a/chronojumpserver/templates/player_list.html
+++ b/chronojumpserver/templates/player_list.html
@@ -33,7 +33,6 @@
 
                                                <div class="form-group">
                                                        <select name="station" class="form-control" 
id="stationSelect">
-                                                                       <option value="">Selecciona una 
estació</option>
                                                                        {% for station in stations %}
                                                                                <option 
value={{station.id}}>{{station.name}}</option>
                                                                        {% endfor %}
@@ -80,9 +79,8 @@
                                                                <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="">Selecciona 
lateralitat</option>
                                                                                <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="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>
diff --git a/chronojumpserver/views.py b/chronojumpserver/views.py
index e336e57..bf10cf8 100755
--- a/chronojumpserver/views.py
+++ b/chronojumpserver/views.py
@@ -38,7 +38,7 @@ def show_sprints():
 def show_players():
     """Show players view."""
     stations = []
-    for station in Station.query.all():
+    for station in Station.query.filter(Station.exercises is not None ):
         stations.append({
             'id': station.id,
             'name': station.name.decode('utf-8'),


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