406 lines
18 KiB
HTML
406 lines
18 KiB
HTML
{% load has_group %}
|
|
{% load is_user_equal_to_gymnast %}
|
|
|
|
<div class="row justify-content-center ml-1">
|
|
<div class="col-md-6">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4>Scores</h4>
|
|
</div>
|
|
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
|
{% if score_list %}
|
|
<div>
|
|
<canvas id="chartjs_routine" class="chartjs" width="400" height="200"></canvas>
|
|
</div>
|
|
|
|
<!-- <table class="table tablesorter table-striped table-condensed" id="scores_table">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 3%"></th>
|
|
<th style="width: 35%" class="header text-left">Event</th>
|
|
<th style="width: 10%" class="header text-center">Date</th>
|
|
<th style="width: 10%" class="header text-center">Routine</th>
|
|
<th style="width: 7%" class="header text-center">Exe.</th>
|
|
<th style="width: 7%" class="header text-center">Dif.</th>
|
|
<th style="width: 7%" class="header text-center">ToF</th>
|
|
<th style="width: 7%" class="header text-center">HD</th>
|
|
<th style="width: 7%" class="header text-center">Pen.</th>
|
|
<th style="width: 7%" class="header text-center">Total</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for score in score_list %}
|
|
<tr class="routine_{{ score.routine_type }}">
|
|
<td>
|
|
<a href="{% url 'score_update' score.id %}">
|
|
<button type="button" rel="tooltip" class="btn btn-link btn-sm btn-icon">
|
|
<span class="tim-icons icon-pencil text-warning"></span>
|
|
</button>
|
|
</a>
|
|
</td>
|
|
<td class="text-left"><a href="{% url 'event_details' score.event.id %}">{{ score.event.name }}</a></td>
|
|
<td class="text-right">{{ score.event.date_begin | date:"d-m-Y" }}</td>
|
|
<td class="text-right">{{ score.get_routine_type_display }}</td>
|
|
<td class="text-right">{{ score.point_execution }}</td>
|
|
<td class="text-right">{{ score.point_difficulty }}</td>
|
|
<td class="text-right">{{ score.point_time_of_flight }}</td>
|
|
<td class="text-right">{{ score.point_horizontal_displacement }}</td>
|
|
<td class="text-center">-{% if score.penality > 0 %}{{ score.penality }}{% endif %}</td>
|
|
<td class="text-right"><b>{{ score.total }}</b></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('#scores_table').tablesorter({
|
|
headers: {
|
|
0: { sorter: false },
|
|
},
|
|
dateFormat: "uk",
|
|
sortList: [[2,0],]
|
|
});
|
|
|
|
$('#checkbox_l1, #checkbox_l2, #checkbox_l3').change(function(){
|
|
if($('#checkbox_l1').is(':checked'))
|
|
$('.routine_0').show();
|
|
else
|
|
$('.routine_0').hide();
|
|
|
|
if($('#checkbox_l2').is(':checked'))
|
|
$('.routine_1').show();
|
|
else
|
|
$('.routine_1').hide();
|
|
|
|
if($('#checkbox_l3').is(':checked'))
|
|
$('.routine_2').show();
|
|
else
|
|
$('.routine_2').hide();
|
|
|
|
{% if request.session.template == 1 %}
|
|
// now add stripes to alternating rows
|
|
$("#scores_table tr:visible").each(function(index){
|
|
// but first remove color that may have been added by previous changes:
|
|
$(this).css("background-color", "inherit");
|
|
if(index % 2 != 0)
|
|
$(this).css("background-color", "#f9f9f9");
|
|
});
|
|
{% endif %}
|
|
});
|
|
});
|
|
</script>
|
|
</div>
|
|
<div class="card-footer text-muted pt-0 text-center">
|
|
L1 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l1" checked />
|
|
L2 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l2" checked />
|
|
L3 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l3" checked />
|
|
</div> -->
|
|
{% else %}
|
|
<p class="pl-3 text-muted">No score recorded for this gymnast.</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="card-footer text-right text-muted pt-0">
|
|
{% if score_list %}
|
|
<a href="{% url 'score_list_for_gymnast' gymnast_id %}">
|
|
<button type="submit" value="add" class="btn btn-icon btn-warning mr-2">
|
|
<i class="fal fa-crosshairs"></i>
|
|
</button>
|
|
</a>
|
|
{% endif %}
|
|
|
|
{% if request.user|has_group:"trainer" or request.user|is_user_equal_to_gymnast:gymnast_id %}
|
|
<a href="{% url 'score_create_for_gymnast' gymnast_id %}">
|
|
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
|
<i class="tim-icons icon-simple-add"></i>
|
|
</button>
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6 pl-1">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4>Chrono</h4>
|
|
</div>
|
|
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
|
{% if chrono_list %}
|
|
<div>
|
|
<canvas id="chartjs_chrono" class="chartjs" width="400" height="200"></canvas>
|
|
</div>
|
|
{% else %}
|
|
<p class="pl-3 text-muted">No chrono recorded for this gymnast.</p>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-footer text-right text-muted pt-0">
|
|
{% if chrono_list %}
|
|
<a href="{% url 'chrono_list_for_gymnast' gymnast_id %}">
|
|
<button type="submit" value="add" class="btn btn-icon btn-warning mr-2">
|
|
<i class="fal fa-stopwatch"></i>
|
|
</button>
|
|
</a>
|
|
{% endif %}
|
|
|
|
{% if request.user|has_group:"trainer" or request.user|is_user_equal_to_gymnast:gymnast_id %}
|
|
<a href="{% url 'chrono_create_for_gymnast' gymnast_id %}">
|
|
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
|
<i class="tim-icons icon-simple-add"></i>
|
|
</button>
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
{% if score_list %}
|
|
var ctx = document.getElementById("chartjs_routine").getContext("2d");
|
|
var gradient_stroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
|
|
var gradient_stroke_2 = ctx.createLinearGradient(0, 230, 0, 50);
|
|
var gradient_stroke_3 = ctx.createLinearGradient(0, 230, 0, 50);
|
|
|
|
gradient_stroke_1.addColorStop(1, 'rgba(255, 99, 132, 0.4)');
|
|
gradient_stroke_1.addColorStop(0.75, 'rgba(255, 99, 132, 0.3)');
|
|
gradient_stroke_1.addColorStop(0.5, 'rgba(255, 99, 132, 0.2)');
|
|
gradient_stroke_1.addColorStop(0.25, 'rgba(255, 99, 132, 0)');
|
|
|
|
gradient_stroke_2.addColorStop(1, 'rgba(255, 159, 64, 0.4)');
|
|
gradient_stroke_2.addColorStop(0.75, 'rgba(255, 159, 64, 0.3)');
|
|
gradient_stroke_2.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
|
|
gradient_stroke_2.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
|
|
|
|
gradient_stroke_3.addColorStop(1, 'rgba(54, 162, 235, 0.4)');
|
|
gradient_stroke_3.addColorStop(0.75, 'rgba(54, 162, 235, 0.3)');
|
|
gradient_stroke_3.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)');
|
|
gradient_stroke_3.addColorStop(0.25, 'rgba(54, 162, 235, 0)');
|
|
|
|
new Chart(document.getElementById("chartjs_routine"),{
|
|
type: 'line',
|
|
data:{
|
|
datasets:[
|
|
{% if score_routine1_list %}
|
|
{
|
|
label: 'R1',
|
|
backgroundColor: gradient_stroke_1,
|
|
borderColor: 'rgb(255, 99, 132)',
|
|
pointBackgroundColor: 'rgb(255, 99, 132)',
|
|
fill: true,
|
|
data: [
|
|
{% for score in score_routine1_list %}
|
|
{
|
|
x: '{{ score.event.date_begin | date:"d-m-Y" }}',
|
|
y: '{{ score.total }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if score_routine2_list %}
|
|
{
|
|
label: 'R2',
|
|
backgroundColor: gradient_stroke_2,
|
|
borderColor: 'rgb(255, 159, 64)',
|
|
pointBackgroundColor: 'rgb(255, 159, 64)',
|
|
fill: true,
|
|
data: [
|
|
{% for score in score_routine2_list %}
|
|
{
|
|
x: '{{ score.event.date_begin | date:"d-m-Y" }}',
|
|
y: '{{ score.total }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if score_routine3_list %}
|
|
{
|
|
label: 'R3',
|
|
backgroundColor: gradient_stroke_3,
|
|
borderColor: 'rgb(54, 162, 235)',
|
|
pointBackgroundColor: 'rgb(54, 162, 235)',
|
|
fill: true,
|
|
data: [
|
|
{% for score in score_routine3_list %}
|
|
{
|
|
x: '{{ score.event.date_begin | date:"d-m-Y" }}',
|
|
y: '{{ score.total }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
],
|
|
},
|
|
options: {
|
|
scales: {
|
|
xAxes: [{
|
|
type: "time",
|
|
time: {
|
|
parser: 'DD-MM-YYYY',
|
|
round: 'day'
|
|
},
|
|
scaleLabel: {
|
|
display: true,
|
|
}
|
|
}, ],
|
|
yAxes: [{
|
|
scaleLabel: {
|
|
display: true,
|
|
}
|
|
}]
|
|
},
|
|
legend: {
|
|
display: true,
|
|
position: 'bottom',
|
|
}
|
|
},
|
|
});
|
|
{% endif %}
|
|
/*
|
|
red: 'rgb(255, 99, 132)',
|
|
orange: 'rgb(255, 159, 64)',
|
|
yellow: 'rgb(255, 205, 86)',
|
|
green: 'rgb(75, 192, 192)',
|
|
blue: 'rgb(54, 162, 235)',
|
|
purple: 'rgb(153, 102, 255)',
|
|
grey: 'rgb(201, 203, 207)'
|
|
|
|
http://www.chartjs.org/samples/latest/scales/time/line-point-data.html
|
|
*/
|
|
|
|
{% if chrono_list %}
|
|
var ctx = document.getElementById("chartjs_chrono").getContext("2d");
|
|
var gradient_stroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
|
|
var gradient_stroke_2 = ctx.createLinearGradient(0, 230, 0, 50);
|
|
var gradient_stroke_3 = ctx.createLinearGradient(0, 230, 0, 50);
|
|
var gradient_stroke_4 = ctx.createLinearGradient(0, 230, 0, 50);
|
|
|
|
gradient_stroke_1.addColorStop(0.75, 'rgba(75, 192, 192, 0.3)');
|
|
gradient_stroke_1.addColorStop(0.5, 'rgba(75, 192, 192, 0.2)');
|
|
gradient_stroke_1.addColorStop(0.25, 'rgba(75, 192, 192, 0)');
|
|
|
|
gradient_stroke_2.addColorStop(1, 'rgba(255, 99, 132, 0.4)');
|
|
gradient_stroke_2.addColorStop(0.75, 'rgba(255, 99, 132, 0.3)');
|
|
gradient_stroke_2.addColorStop(0.5, 'rgba(255, 99, 132, 0.2)');
|
|
gradient_stroke_2.addColorStop(0.25, 'rgba(255, 99, 132, 0)');
|
|
|
|
gradient_stroke_3.addColorStop(1, 'rgba(255, 159, 64, 0.4)');
|
|
gradient_stroke_3.addColorStop(0.75, 'rgba(255, 159, 64, 0.3)');
|
|
gradient_stroke_3.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
|
|
gradient_stroke_3.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
|
|
|
|
gradient_stroke_4.addColorStop(1, 'rgba(54, 162, 235, 0.4)');
|
|
gradient_stroke_4.addColorStop(0.75, 'rgba(54, 162, 235, 0.3)');
|
|
gradient_stroke_4.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)');
|
|
gradient_stroke_4.addColorStop(0.25, 'rgba(54, 162, 235, 0)');
|
|
|
|
new Chart(document.getElementById("chartjs_chrono"),{
|
|
type: 'line',
|
|
data:{
|
|
datasets:[
|
|
{% if chrono_10c %}
|
|
{
|
|
label: '10 |',
|
|
backgroundColor: gradient_stroke_1,
|
|
borderColor: 'rgb(75, 192, 192)',
|
|
pointBackgroundColor: 'rgb(75, 192, 192)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_10c %}
|
|
{
|
|
x: '{{ chrono.date | date:"d-m-Y" }}',
|
|
y: '{{ chrono.score_avg }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if chrono_r1 %}
|
|
{
|
|
label: 'R1',
|
|
backgroundColor: gradient_stroke_2,
|
|
borderColor: 'rgb(255, 99, 132)',
|
|
pointBackgroundColor: 'rgb(255, 99, 132)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_r1 %}
|
|
{
|
|
x: '{{ chrono.date | date:"d-m-Y" }}',
|
|
y: '{{ chrono.score_avg }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if chrono_r2 %}
|
|
{
|
|
label: 'R2',
|
|
backgroundColor: gradient_stroke_3,
|
|
borderColor: 'rgb(255, 159, 64)',
|
|
pointBackgroundColor: 'rgb(255, 159, 64)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_r2 %}
|
|
{
|
|
x: '{{ chrono.date | date:"d-m-Y" }}',
|
|
y: '{{ chrono.score_avg }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if chrono_rf %}
|
|
{
|
|
label: 'R3',
|
|
backgroundColor: gradient_stroke_4,
|
|
borderColor: 'rgb(255, 205, 86)',
|
|
pointBackgroundColor: 'rgb(255, 205, 86)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_rf %}
|
|
{
|
|
x: '{{ chrono.date | date:"d-m-Y" }}',
|
|
y: '{{ chrono.score_avg }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
],
|
|
},
|
|
|
|
options: {
|
|
scales: {
|
|
xAxes: [{
|
|
type: "time",
|
|
time: {
|
|
parser: 'DD-MM-YYYY',
|
|
round: 'day'
|
|
},
|
|
scaleLabel: {
|
|
display: true,
|
|
}
|
|
}, ],
|
|
yAxes: [{
|
|
scaleLabel: {
|
|
display: true,
|
|
}
|
|
}]
|
|
},
|
|
legend: {
|
|
display: true,
|
|
position: 'bottom',
|
|
}
|
|
},
|
|
});
|
|
{% endif %}
|
|
</script>
|