Lot of minor improvements

This commit is contained in:
Gregory Trullemans 2022-10-14 06:24:07 +02:00
parent 58c5d83658
commit eac92bb36f
10 changed files with 33 additions and 95 deletions

View File

@ -1,41 +0,0 @@
<canvas id="chartjs_completude" style="position: relative; height:40vh; width:80vw"></canvas>
<script type="text/javascript">
var completude_data = {
datasets:[{
borderWidth: 0,
data: [
{{ nb_skill_masterised }},
{{ nb_skill_chained }},
{{ nb_skill_without_help }},
{{ nb_skill_whith_help }},
{{ nb_unknown_skill }}
],
backgroundColor: [
"#1CA8DD",
"#1BC98E", /*"#1ca8dd",*/
"#FEFB01",
"#FF9300",
"#FF2F92", /*"#1bc98e"*/
]
}],
labels: ['Skill masterised', 'Chained skills ', 'Skills without help', 'Skills with help', 'Unknown Skills'],
};
new Chart(document.getElementById("chartjs_completude"),{
responsive: true,
maintainAspectRatio: true,
type: "doughnut",
data: completude_data,
options: {
plugins: {
legend: {
display: false,
},
},
cutoutPercentage: 55,
maintainAspectRatio: false,
},
});
</script>

View File

@ -1,18 +0,0 @@
<h4 class="d-flex align-items-end flex-column">
Estimated level : {% if gymnast_nb_known_skills %}{{ evaluated_level }}{% else %}0{% endif %}
</h4>
<div class="progress-container progress-primary">
<div class="progress" style="height: 10px;">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: {{ percentage_known_skill }}%;"></div>
</div>
</div>
<!-- {{ nb_known_skill }} known skills on {{ nb_skill }} skills. -->
{% for level in percentages %}
{% if level.2 > 0 %}
<div class="progress-container progress-warning mt-2">
<div class="progress" style="height: 10px;">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: {% widthratio level.2 level.1 100 %}%;">&nbsp;&nbsp;Level {{ level.0 }}</div>
</div>
</div>
{% endif %}
{% endfor %}

View File

@ -22,7 +22,7 @@
<div class="card-header">
<h4>Next events</h4>
</div>
<div class="card-body pt-0 pb-0 pr-1 pl-1">
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if next_event_list %}
<table class="table tablesorter table-condensed table-striped" id="next_events">
<thead>
@ -42,31 +42,19 @@
{% endfor %}
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function(){
$('#next_events').tablesorter({
dateFormat: "uk",
headers: {
0: { sorter: false }, // disable first column
},
sortList: [[3,0]]
});
});
</script>
{% else %}
<p class="text-muted">No next event associated to this gymnast.</p>
<p class="pl-3 pb-3 text-muted">No next event associated to this gymnast.</p>
{% endif %}
</div>
</div>
</div>
<div class="col-md-6 pl-1">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h4>Notes</h4>
</div>
<div class="card-body pt-0 pb-0 pr-1 pl-1">
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if last_notes_list %}
<table class="table tablesorter table-condensed table-striped" id="notes">
<thead>
@ -94,7 +82,7 @@
</tbody>
</table>
{% else %}
<p class="text-muted">No note for this gymnast.</p>
<p class="pl-3 text-muted">No note for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
@ -110,18 +98,6 @@
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#notes').tablesorter({
dateFormat: "uk",
headers: {
0: { sorter: false }, // disable first column
},
sortList: [[3,1]],
});
});
</script>
{% if previous_events %}
<div class="row justify-content-center ml-3 pr-0">
<div class="col-md-12 pr-0">
@ -196,6 +172,26 @@
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#next_events').tablesorter({
dateFormat: "uk",
headers: {
0: { sorter: false }, // disable first column
},
sortList: [[3,0]]
});
});
$(document).ready(function() {
$('#notes').tablesorter({
dateFormat: "uk",
headers: {
0: { sorter: false }, // disable first column
},
sortList: [[3,1]],
});
});
$(document).ready(function() {
$('#previous_events').tablesorter({
dateFormat: "uk",

View File

@ -30,6 +30,7 @@
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">

View File

@ -135,7 +135,7 @@
{% endif %}
</div>
{% endif %}
<div class="col-md-6 text-right text-muted pt-0">
<div class="col-md-6 {% if not ghr_list %}offset-md-6{% endif %} text-right text-muted pt-0">
{% if routine_done_list %}
<a href="{% url 'routinedone_list_for_gymnast' gymnast_id %}">
<button type="submit" value="list" class="btn btn-icon btn-warning mr-2">

View File

@ -487,7 +487,7 @@
});
});
$('#table_by_rank, #table_by_level, #table_by_age, #table_unknown_skill, #table_skill_with_help, #table_skill_without_help').tablesorter({
$('#table_by_rank, #table_by_level, #table_by_age, #table_unknown_skill, #table_skill_with_help, #table_skill_without_help, #table_skill_chained').tablesorter({
{% if user_is_trainer %}
headers: {
0: { sorter: false }, // disable first column

View File

@ -237,7 +237,7 @@ class Gymnast(Markdownizable):
c. on calcule les statistiques du gymnaste par rapport aux skill
SINON:
on va chercher tous les Skill qui existent, on les met dans une liste et on les compte.
on va chercher tous les Skill qui existent et on les compte.
"""
if desired_type != "level" and desired_type != "rank":
@ -245,10 +245,10 @@ class Gymnast(Markdownizable):
context = {}
skill_max = self.skill_max_for_type(desired_type)
cpt_known_skill_by_type = self.nb_known_skill_by_type(desired_type)
gymnast_nb_known_skills = self.known_skills.distinct("skill").count()
if skill_max > 0:
cpt_known_skill_by_type = self.nb_known_skill_by_type(desired_type) # à remonter ???
cpt_skill_by_type = nb_skill_by_type(skill_max, desired_type)
context["total_skill"] = nb_skill_lte_type(skill_max, desired_type)
context["percentages"] = compute_statistics_by_type(

View File

@ -5,7 +5,7 @@ from ultron.people.models import Gymnast
register = template.Library()
@register.inclusion_tag("people/gymnasts/skill_level_chart_bar.html")
@register.inclusion_tag("people/gymnasts/gymnast_level_chart_bar.html")
def generate_level_chart_bar(gymnast_id):
"""
Tag permettant l'affichage des statistiques d'un gymnaste : le nombre de saut qu'il sait faire

View File

@ -5,7 +5,7 @@ from ultron.followup.models import LearnedSkill
register = template.Library()
@register.inclusion_tag("people/gymnasts/skill_doughnut.html")
@register.inclusion_tag("people/gymnasts/gymnast_level_doughnut.html")
def generate_skill_doughnut(gymnast_id):
"""
Récupère les différents nombres de skill du gymnaste (masterised, chained, without help,

View File

@ -259,7 +259,7 @@ def gymnast_display_events_and_notes(request, gymnast_id):
@require_http_methods(["GET"])
def gymnast_display_accident(request, gymnast_id):
"""
Renvoie deux listes d'évènements : ceux à venir et ceux passés.
Renvoie la liste des accidents d'un gymnaste.
"""
accident_list = Accident.objects.filter(gymnast=gymnast_id)
context = {"accident_list": accident_list, "gymnast_id": gymnast_id}