From 51b6598747dbe3fd71388b373d834146f277a485 Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Sat, 24 Feb 2024 22:27:20 +0100 Subject: [PATCH] minor updates --- jarvis/objective/models.py | 28 +++++--- .../gymnasts/tabs/tab_documents.html | 64 +++++++++++++++++-- .../gymnasts/tabs/tab_events_and_notes.html | 11 +++- .../tabs/{tab_skill.html => tab_skills.html} | 8 ++- jarvis/people/urls.py | 2 +- jarvis/people/views.py | 2 +- 6 files changed, 97 insertions(+), 18 deletions(-) rename jarvis/people/templates/gymnasts/tabs/{tab_skill.html => tab_skills.html} (99%) diff --git a/jarvis/objective/models.py b/jarvis/objective/models.py index 6e93748..7893e3b 100644 --- a/jarvis/objective/models.py +++ b/jarvis/objective/models.py @@ -248,14 +248,26 @@ class Skill(Educative): class Routine(Educative): """ - Classe représentant une série (enchainement de plusieurs figures). Elle hérite de la classe - `Educative`. - Cette classe permet donc de représenter tout enchaînement de figures. Il existe 4 types - d'enchaînements : - - les enchaînements de compétition (série de compétition) : is_routine = True & is_competitive = True - - les enchaînements (non autorisé en compétition) : is_routine = True - - les éducatifs (enchainements courts en vue d'apprendre une figure précise) : is_routine = False - - les combinaisons : combinaisons de touche (pas enchainées, pas liées par des tirets) + Classe représentant une combinaison de plusieurs figures. Elle hérite de la classe + `Educative`. Cette classe permet donc de représenter toute combinaison de figures. + Il existe 4 types de combinaison : + - les combinaisons : + * tout ensemble de plus d'un + * liés par des "&" + - les enchaînements : + * ce sont des combinaisons particulière : les saut doivent être enchaînés. + * Peu importe le nombre de . + * liés par des "-" + * is_routine = True + - les enchaînements de compétition (série de compétition) : + * ce sont des enchaûnements particuliers : + * les sauts doivent être enchaînés, + * au nombre de 10 (pas plus, pas moins), + * composé que de autorisés en compétition, + * etc. + * is_routine = True + * is_competitive = True + - les éducatifs (enchainements courts en vue d'apprendre une figure précise) """ class Meta: diff --git a/jarvis/people/templates/gymnasts/tabs/tab_documents.html b/jarvis/people/templates/gymnasts/tabs/tab_documents.html index 2be7b0f..5c867a5 100644 --- a/jarvis/people/templates/gymnasts/tabs/tab_documents.html +++ b/jarvis/people/templates/gymnasts/tabs/tab_documents.html @@ -158,6 +158,34 @@ $('#span_month_button_generate').hide(); $('#span_season_button_generate').hide(); + function check_comparison_fields(){ + alert("check comparison fields") + if($('#select_week_number1').val() == '') + return false; + + if($('#select_week_number2').val() == '') + return false; + + if ($('#select_week_number2').val() == $('#select_week_number2').val()) + return false; + + return true; + } + + function show_comparison_button(){ + var tmp_url = "{% url 'gymnast_generate_report_week_comparison' gymnast.id '_season_source_' 9999 '_season_target_' 8888 %}"; + + season_source = $('#select_season_for_week1').val() + week_source = $('#select_week_number1').val() + season_target = $('#select_season_for_week2').val() + week_target = $('#select_week_number2').val() + + target_url = tmp_url.replace('_season_source_', season_source).replace('9999', week_source).replace('_season_target_', season_target).replace('8888', week_target); + + $('#week_comprison_pdf_link').attr('href', target_url); + $('#span_week_comparison_button_generate').show() + } + $('#select_season_for_week').change(function(){ var tmp_url = "{% url 'get_distinct_week_number_for_season_and_gymnast' gymnast.id '_season_label_' %}"; var season_label = $(this).children("option:selected").val(); @@ -178,10 +206,38 @@ }); }); - $('#select_season_for_week1').change(); - $('#select_week_number1').change(); - $('#select_season_for_week2').change(); - $('#select_week_number2').change(); + $('#select_season_for_week1').change(function(){ + var test = check_comparison_fields(); + if(test) + show_comparison_button(); + else + $('#span_week_comparison_button_generate').hide(); + }); + + $('#select_week_number1').change(function(){ + var test = check_comparison_fields(); + if(test) + show_comparison_button(); + else + $('#span_week_comparison_button_generate').hide(); + }); + + $('#select_season_for_week2').change(function(){ + var test = check_comparison_fields(); + if(test) + show_comparison_button(); + else + $('#span_week_comparison_button_generate').hide(); + }); + + $('#select_week_number2').change(function(){ + var test = check_comparison_fields(); + if(test) + show_comparison_button(); + else + $('#span_week_comparison_button_generate').hide(); + }); + $('#select_week_number').change(function(){ if ($('#select_week_number').val() != "") { diff --git a/jarvis/people/templates/gymnasts/tabs/tab_events_and_notes.html b/jarvis/people/templates/gymnasts/tabs/tab_events_and_notes.html index 2c53409..1d64237 100644 --- a/jarvis/people/templates/gymnasts/tabs/tab_events_and_notes.html +++ b/jarvis/people/templates/gymnasts/tabs/tab_events_and_notes.html @@ -47,8 +47,15 @@ {{ event.name }} {{ event.date_begin | date:"d-m-Y"}} - {% if event.number_of_week_from_today < 0 %}{{event.number_of_week_from_today}}{% else %} - {{event.number_of_week_from_today}}{% endif %} + + {% if event.number_of_week_from_today < 0 %} + {{event.number_of_week_from_today}} + {% else %} + + {{event.number_of_week_from_today}} + + {% endif %} + {% endfor %} diff --git a/jarvis/people/templates/gymnasts/tabs/tab_skill.html b/jarvis/people/templates/gymnasts/tabs/tab_skills.html similarity index 99% rename from jarvis/people/templates/gymnasts/tabs/tab_skill.html rename to jarvis/people/templates/gymnasts/tabs/tab_skills.html index 118009a..e0077b5 100644 --- a/jarvis/people/templates/gymnasts/tabs/tab_skill.html +++ b/jarvis/people/templates/gymnasts/tabs/tab_skills.html @@ -129,7 +129,9 @@ {% endif %} {{ plan.educative.skill.notation }} - {{ plan.educative.long_label }} + + {{ plan.educative.long_label }} + {{ plan.get_learning_step_display }} @@ -185,7 +187,9 @@ {% endif %} {{ skill.notation }} - {{ skill.long_label }} + + {{ skill.long_label }} + {{ skill.difficulty }} {{ skill.level }} {{ skill.rank }} diff --git a/jarvis/people/urls.py b/jarvis/people/urls.py index 1de1ca1..4e42c41 100644 --- a/jarvis/people/urls.py +++ b/jarvis/people/urls.py @@ -80,7 +80,7 @@ gymnast_urlpatterns = [ name="gymnast_report_export_for_season", ), path( - r"report/comparison//season//week//season//week/", + r"report/comparison//season//week//season//week//", views_reports.generate_report_week_comparison, name="gymnast_generate_report_week_comparison", ), diff --git a/jarvis/people/views.py b/jarvis/people/views.py index df9ea3f..e8977dd 100644 --- a/jarvis/people/views.py +++ b/jarvis/people/views.py @@ -520,4 +520,4 @@ def gymnast_display_skill(request, gymnast_id): context["user_is_trainer"] = request.user.groups.filter( name="trainer" ).exists() # TODO: utiliser les {{ perms }} - return render(request, "gymnasts/tabs/tab_skill.html", context) + return render(request, "gymnasts/tabs/tab_skills.html", context)