[chronojump-server] Calculate speed on macro Tasks
- From: Marcos Venteo Garcia <mventeo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] Calculate speed on macro Tasks
- Date: Mon, 19 Feb 2018 18:34:17 +0000 (UTC)
commit 99da3f87e0108225f44a1d25e87082467f65fc90
Author: Marcos Venteo <mventeo gmail com>
Date: Mon Feb 19 19:33:55 2018 +0100
Calculate speed on macro Tasks
chronojumpserver/templates/player_list.html | 32 +++++++++++++++++++++------
1 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/chronojumpserver/templates/player_list.html b/chronojumpserver/templates/player_list.html
index b9148b1..3f1a25c 100755
--- a/chronojumpserver/templates/player_list.html
+++ b/chronojumpserver/templates/player_list.html
@@ -203,7 +203,7 @@
</div> <!-- .modal-body -->
<div class="modal-footer">
<button type="button" class="pull-left btn btn-default"
data-dismiss="modal">Cancelar</button>
- <button id="btnResetMacroTask" type="button" class="pull-left btn btn-default
hidden" >Reset</button>
+ <button id="btnResetMacroTask" type="button" class="pull-left btn btn-default
hidden" >Neteja</button>
<button id="btnCreateTasks" type="button" class="pull-right btn btn-primary
hidden" >Crear tasques</button>
<button id="btnAddTask" type="button" class="pull-right btn btn-primary
hidden" onclick="addModifyDeleteTask(0)">Afegir</button>
<button id="btnAddMacroTask" type="button" class="pull-right btn btn-primary
hidden" onclick="addMacroTask()">Afegir tasques</button>
@@ -268,6 +268,14 @@ $('#btnCreateTasks').click(function(e) {
$('#btnCreateTasks').addClass('hidden');
$('#btnAddMacroTask').removeClass('hidden');
+ $('.macroPercentMaxSpeed').change(function(){
+ // Calculate the max velocity
+ var idx = $(this).attr('idx');
+ var percent = $(this).val();
+ var maxVelocity = $('#taskMaxSpeed2').val();
+ var calculateVelocity = (percent * maxVelocity) / 100;
+ $('.macroSpeed[idx='+idx+']').val(calculateVelocity.toFixed(2));
+ });
});
/* Remove all macro task to start again */
@@ -300,16 +308,16 @@ function createTaskInTable(numTask) {
$('#tasksTable').removeClass("hidden");
var percentMaxSpeed = $('#taskpercentMaxSpeed2').val();
html += "<td>" + (numTask + 1) + "</td>";
- html += "<td><input class='macroLoad form-control' type='number' value='" + load + "'/></td>";
+ html += "<td><input class='macroLoad form-control' type='number' value='" + load + "'
idx='"+numTask+"'/></td>";
console.log(percentMaxSpeed);
if (percentMaxSpeed == '') {
- html += "<td><input class='macroPercentMaxSpeed form-control' disabled type='number' /></td>";
+ html += "<td><input class='macroPercentMaxSpeed form-control' disabled type='number'
idx='"+numTask+"'/></td>";
} else {
- html += "<td><input class='macroPercentMaxSpeed form-control' type='number' value='"+
percentMaxSpeed + "' /></td>";
+ html += "<td><input class='macroPercentMaxSpeed form-control' type='number' idx='"+numTask+"'
value='"+ percentMaxSpeed + "' /></td>";
}
- html += "<td><input class='macroSpeed form-control' type='number' value='" + speed + "' /></td>";
- html += "<td><input class='macroLossByPower form-control' type='number' value='" + lossByPower +
"'/></td>";
- html += "<td><input class='macroLossBySpeed form-control' type='number' value='" + lossBySpeed +
"'/></td>";
+ html += "<td><input class='macroSpeed form-control' type='number' value='" + speed + "'
idx='"+numTask+"'/></td>";
+ html += "<td><input class='macroLossByPower form-control' type='number' value='" + lossByPower + "'
idx='"+numTask+"'/></td>";
+ html += "<td><input class='macroLossBySpeed form-control' type='number' value='" + lossBySpeed + "'
idx='"+numTask+"'/></td>";
html += "</tr>";
@@ -911,5 +919,15 @@ $('#taskpercentMaxSpeed').change(function(){
});
+$('#taskpercentMaxSpeed2').change(function(){
+ // Calculate the max velocity
+ var maxVelocity = $('#taskMaxSpeed2').val();
+ var percent = $(this).val();
+ var calculateVelocity = (percent * maxVelocity) / 100;
+ $('#taskSpeed2').val(calculateVelocity.toFixed(2));
+});
+
+
+
</script>
{% endblock %}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]