[chronojump-server] Bug fixing - Deletion button won’t be enabled after a previous deletion - Max velocity is not calc



commit 74d214b641fade35148d0549bdff05f7f81b4542
Author: Marcos Venteo García <mventeo gmail com>
Date:   Sun Sep 17 11:44:46 2017 +0200

    Bug fixing
    - Deletion button won’t be enabled after a previous deletion
    - Max velocity is not calculated when user changes station

 chronojumpserver/templates/airport.html       |   14 -------
 chronojumpserver/templates/player_detail.html |   14 -------
 chronojumpserver/templates/player_list.html   |   46 +++++++++++--------------
 chronojumpserver/templates/results.html       |   34 ++++++------------
 chronojumpserver/templates/sprints.html       |   14 -------
 chronojumpserver/templates/station_list.html  |   14 -------
 6 files changed, 31 insertions(+), 105 deletions(-)
---
diff --git a/chronojumpserver/templates/airport.html b/chronojumpserver/templates/airport.html
index f3cce25..149bb08 100644
--- a/chronojumpserver/templates/airport.html
+++ b/chronojumpserver/templates/airport.html
@@ -79,20 +79,6 @@
  * Airport javascript functions for Chronojump Server
  * Author: Marcos Venteo <mventeo gmail com>
  * version: 1.0
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 $(document).ready(function() {
diff --git a/chronojumpserver/templates/player_detail.html b/chronojumpserver/templates/player_detail.html
index e0ba293..622eae7 100755
--- a/chronojumpserver/templates/player_detail.html
+++ b/chronojumpserver/templates/player_detail.html
@@ -46,20 +46,6 @@
  * Player Detail javascript functions for Chronojump Server
  * Author: Marcos Venteo <mventeo gmail com>
  * version: 1.0
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 
diff --git a/chronojumpserver/templates/player_list.html b/chronojumpserver/templates/player_list.html
index 4457cbe..e74f3e1 100755
--- a/chronojumpserver/templates/player_list.html
+++ b/chronojumpserver/templates/player_list.html
@@ -77,7 +77,7 @@
                                                                </div>
                                                                <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" disabled></input>
+                                                                       <input id="taskpercentMaxSpeed" 
name="taskpercentMaxSpeed" type="number" class="form-control" disabled max="100" min="0"></input>
                                                                </div>
                                                        </div>
                                                        <div class="form-group taskParameter">
@@ -126,20 +126,6 @@
  * Player javascript functions for Chronojump Server
  * Author: Marcos Venteo <mventeo gmail com>
  * version: 1.0
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 /* Function to add/Modify or delete a task called from Task Modal Form. */
@@ -458,8 +444,7 @@ $(document).ready(function() {
         // Show the exercises of this station
         refreshExercises(null);
 
-        // get max_velocity
-        get_max_velocity();
+
 
     });
 
@@ -500,27 +485,30 @@ $(document).ready(function() {
 
                 // Add all the exercises of the station
                 var count = 0;
-                $.each(data.data, function(i, item) {
+                               $.each(data.data, function(i, item) {
                     count ++;
                     $('#exerciseSelect').append($('<option>', {
                         value: item.id,
                         text: item.name
                     }));
-
-                })
+                               })
                 // If exerciseId is not Null, set the values
                 if (exerciseId) {
                     $('#exerciseSelect').val(exerciseId);
                 }
                 if (count > 0) {
                     $('#exerciseSelect').removeAttr('disabled');
+                                       // Set the first option as selected
+                                       $('#exerciseSelect').val($('#exerciseSelect option:first').val());
+                                       //$('#exerciseSelect').val($('#exerciseSelect option:first').val());
                 }
+                               // Calculate max_velocity
+                       get_max_velocity();
             });
         }
     }
 
-    // Refresh Exercises at the begining
-    refreshExercises(null);
+
 
     $('#taskLoad').change(function() {
         get_max_velocity()
@@ -535,14 +523,18 @@ $(document).ready(function() {
         var resistance = $('#taskLoad').val();
         var stationId = $('#stationSelect').val();
         var personId = $('#playerId').val();
+
         var exerciseId = $('#exerciseSelect').val();
+               if (exerciseId == null) {
+                       exerciseId = $('#exerciseSelect option:first').val();
+               }
         var laterality = $('#taskLaterality').val();
-        console.log("Check velocity max");
+        /*console.log("Check velocity max");
         console.log("Resistance: " + resistance);
         console.log("Station Id: " + stationId);
         console.log("Exercise Id: " + exerciseId);
         console.log("Person Id: " + personId);
-        console.log("Laterality:" + laterality);
+        console.log("Laterality:" + laterality);*/
         if (resistance) {
             $.ajax({
                 url: '/api/v1/get_max_velocity',
@@ -559,14 +551,14 @@ $(document).ready(function() {
                 // First remove previous options
 
                 if (data.max_velocity > 0 ) {
-                    console.log("Enable taskPercentMaxSpeed");
+                    //console.log("Enable taskPercentMaxSpeed");
                     $('#taskSpeed').prop('disabled', false);
                                        $('#taskMaxSpeed').val(data.max_velocity.toFixed(2));
                                        $('#taskMaxSpeed').prop('disabled', false);
                     $('#taskpercentMaxSpeed').prop('disabled', false);
                 } else {
                     // No velocity max, means disable velocityMAx control
-                    console.log("Disable taskPercentMaxSpeed");
+                    //console.log("Disable taskPercentMaxSpeed");
                     $('#taskSpeed').prop('disabled', false);
                                        $('#taskMaxSpeed').val('');
                                        $('#taskMaxSpeed').prop('disabled', true);
@@ -578,6 +570,8 @@ $(document).ready(function() {
        }
     }
 
+       // Refresh Exercises at the begining
+    refreshExercises(null);
 
 });
 
diff --git a/chronojumpserver/templates/results.html b/chronojumpserver/templates/results.html
index 3b07219..c4da67d 100755
--- a/chronojumpserver/templates/results.html
+++ b/chronojumpserver/templates/results.html
@@ -70,22 +70,6 @@
  * Results javascript functions for Chronojump Server
  * Author: Marcos Venteo <mventeo gmail com>
  * version: 1.0
- *
- * Copyright (C) 2017  Xavier de Blas <xaviblas gmail com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
  function formatDateNumber(val) {
@@ -269,9 +253,9 @@ $(document).ready(function() {
                                // Ask for confirmation
                                var total =  $('.deleteCheckbox:checked').length;
                                if (total == 1) {
-                                 var r = confirm("Estàs segur de que vols esborrar aquest resultat?");
+                                 var r = confirm("Estàs segur que vols esborrar aquest resultat?");
                                } else {
-                                 var r = confirm("Estàs segur de que vols esborrar aquests resultats?");
+                                 var r = confirm("Estàs segur que vols esborrar aquests resultats?");
                                }
                                if (r == true) {
                                  var results = [];
@@ -291,7 +275,7 @@ $(document).ready(function() {
                                        // Results have been deleted. Refresh table and enable again the 
interval
                                        console.log(msg);
                                        $('.btnDeleteResults').addClass('disabled');
-                                       table.ajax.reload(null, false);
+                                       table.ajax.reload(enableDeletion, false);
                                        refreshIntervalId = refreshIntervalTrigger();
                                        console.log("Interval refresh is enabled with id " + 
refreshIntervalId);
                                  })
@@ -386,6 +370,13 @@ $(document).ready(function() {
                  });
                }
          });
+         enableDeletion();
+       }
+  });
+
+  /* Enable the result deletion */
+  function enableDeletion() {
+
 
          // Called every time a delete checkbox is changed
          $('.deleteCheckbox').on('change', function() {
@@ -406,10 +397,7 @@ $(document).ready(function() {
                        console.log("Interval refresh is enabled with id " + refreshIntervalId);
                  }
          });
-
-       }
-  });
-
+  }
 
   function refreshIntervalTrigger() {
        return setInterval(function() {
diff --git a/chronojumpserver/templates/sprints.html b/chronojumpserver/templates/sprints.html
index 8b46aab..cbf7e9e 100755
--- a/chronojumpserver/templates/sprints.html
+++ b/chronojumpserver/templates/sprints.html
@@ -55,20 +55,6 @@
  * ResultSprints javascript functions for Chronojump Server
  * Author: Marcos Venteo <mventeo gmail com>
  * version: 1.0
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 function formatDateNumber(val) {
diff --git a/chronojumpserver/templates/station_list.html b/chronojumpserver/templates/station_list.html
index 1fe128a..23c6f7d 100644
--- a/chronojumpserver/templates/station_list.html
+++ b/chronojumpserver/templates/station_list.html
@@ -99,20 +99,6 @@
  * Station javascript functions for Chronojump Server
  * Author: Marcos Venteo <mventeo gmail com>
  * version: 1.0
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
 


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