diff --git a/jarvis/followup/templates/chronos/list.html b/jarvis/followup/templates/chronos/list.html
index 2122784..ec4fefa 100644
--- a/jarvis/followup/templates/chronos/list.html
+++ b/jarvis/followup/templates/chronos/list.html
@@ -6,7 +6,9 @@
@@ -23,15 +25,68 @@
+ {% if gymnast %}
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ {% for chrono in chrono_list %}
+
+
+
+
+
+
+
+
+
+ |
+
+ {% if chrono.details.all %}
+
+ {% endif %}
+ {{ chrono.date | date:"j-n-Y" }}
+ {% if chrono.details.all %}
+
+ {% endif %}
+ |
+
+ {% if chrono.routine %}
+ {{ chrono.routine.long_label }}
+ {% else %}
+ {{ chrono.get_chrono_type_display }}
+ {% endif %}
+ |
+ {{ chrono.get_score_type_display }} |
+ {{ chrono.score }} |
+ {{ chrono.tof }} |
+
+ {% endfor %}
+
+
+
+
+
+
+
+ {% else %}
{% if chrono_list %}
{% else %}
-
There are no chronos corresponding to your criterias.
+
There are no chronos corresponding to your criterias.
+ {% endif %}
{% endif %}
@@ -100,5 +154,150 @@
"bInfo": false,
});
});
+
+ {% if chrono_list %}
+ var timeFormat = 'DD-MM-YYYY';
+ var ctx = document.getElementById('chart_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)');
+
+ var straightjump_values = [
+ {% for chrono in chrono_10c %}
+ {
+ x: '{{ chrono.date | date:"d-m-Y" }}',
+ y: '{{ chrono.score_avg | floatformat:3 }}'
+ },
+ {% endfor %}
+ ];
+
+ var compulsory_routine_values = [
+ {% for chrono in chrono_r1 %}
+ {
+ x: '{{ chrono.date | date:"d-m-Y" }}',
+ y: '{{ chrono.score_avg | floatformat:3 }}'
+ },
+ {% endfor %}
+ ];
+
+ var volontary_routine_values = [
+ {% for chrono in chrono_r2 %}
+ {
+ x: '{{ chrono.date | date:"d-m-Y" }}',
+ y: '{{ chrono.score_avg | floatformat:3 }}'
+ },
+ {% endfor %}
+ ];
+
+ var final_routine_values = [
+ {% for chrono in chrono_rf %}
+ {
+ x: '{{ chrono.date | date:"d-m-Y" }}',
+ y: '{{ chrono.score_avg | floatformat:3 }}'
+ },
+ {% endfor %}
+ ];
+
+ var chrono_values = {
+ datasets: [
+ {% if chrono_10c %}
+ {
+ label: '10 |',
+ cubicInterpolationMode: 'monotone',
+ backgroundColor: gradient_stroke_1,
+ borderColor: 'rgb(75, 192, 192)',
+ pointBackgroundColor: 'rgb(75, 192, 192)',
+ fill: true,
+ data: straightjump_values,
+ },
+ {% endif %}
+ {% if chrono_r1 %}
+ {
+ label: 'Q1R1',
+ cubicInterpolationMode: 'monotone',
+ backgroundColor: gradient_stroke_2,
+ borderColor: 'rgb(255, 99, 132)',
+ pointBackgroundColor: 'rgb(255, 99, 132)',
+ fill: true,
+ data: compulsory_routine_values,
+ },
+ {% endif %}
+ {% if chrono_r2 %}
+ {
+ label: 'Q1R2',
+ cubicInterpolationMode: 'monotone',
+ backgroundColor: gradient_stroke_3,
+ borderColor: 'rgb(255, 159, 64)',
+ pointBackgroundColor: 'rgb(255, 159, 64)',
+ fill: true,
+ data: volontary_routine_values,
+ },
+ {% endif %}
+ {% if chrono_rf %}
+ {
+ label: 'Q2R1',
+ cubicInterpolationMode: 'monotone',
+ backgroundColor: gradient_stroke_4,
+ borderColor: 'rgb(255, 205, 86)',
+ pointBackgroundColor: 'rgb(255, 205, 86)',
+ fill: true,
+ data: final_routine_values,
+ },
+ {% endif %}
+ ]
+ }
+
+ new Chart(ctx, {
+ type: 'line',
+ data: chrono_values,
+ options: {
+ scales: {
+ x: {
+ type: 'time',
+ display: true,
+ scaleLabel: {
+ display: true,
+ labelString: 'Date',
+ ticks: {
+ autoSkip: true,
+ source: 'data',
+ },
+ },
+ time: {
+ parser: timeFormat,
+ tooltipFormat: 'LL',
+ round: 'day',
+ },
+ },
+ },
+ plugins: {
+ legend: {
+ display: true,
+ position: 'bottom',
+ }
+ }
+ },
+ });
+ {% endif %}
{% endblock %}
\ No newline at end of file
diff --git a/jarvis/followup/views_chrono.py b/jarvis/followup/views_chrono.py
index a067079..dca60b7 100644
--- a/jarvis/followup/views_chrono.py
+++ b/jarvis/followup/views_chrono.py
@@ -383,8 +383,17 @@ def chrono_listing(request, gymnast_id=None):
and gymnast_id in request.session["available_gymnast"]
)
):
- chrono_list = Chrono.objects.filter(gymnast=gymnast_id)
gymnast = Gymnast.objects.get(pk=gymnast_id)
+ chrono_list = Chrono.objects.filter(gymnast=gymnast_id).order_by("date")
+ base_queryset = chrono_list.values("date").annotate(score_avg=Avg("tof"))
+
+ context = {
+ "chrono_10c": base_queryset.filter(chrono_type=0),
+ "chrono_r1": base_queryset.filter(chrono_type=1),
+ "chrono_r2": base_queryset.filter(chrono_type=2),
+ "chrono_rf": base_queryset.filter(chrono_type=3),
+ }
+
else:
if request.user.is_superuser:
chrono_list = Chrono.objects.all()
@@ -393,7 +402,8 @@ def chrono_listing(request, gymnast_id=None):
gymnast__in=request.session["available_gymnast"]
)
- context = {"chrono_list": chrono_list, "gymnast": gymnast}
+ context["chrono_list"] = chrono_list
+ context["gymnast"] = gymnast
return render(request, "chronos/list.html", context)
diff --git a/jarvis/people/templates/gymnasts/tabs/tab_intensity_and_chronos.html b/jarvis/people/templates/gymnasts/tabs/tab_intensity_and_chronos.html
index 79f3b92..ddcf8c8 100644
--- a/jarvis/people/templates/gymnasts/tabs/tab_intensity_and_chronos.html
+++ b/jarvis/people/templates/gymnasts/tabs/tab_intensity_and_chronos.html
@@ -95,9 +95,8 @@