minor updates

This commit is contained in:
Gregory Trullemans 2024-02-24 22:27:20 +01:00
parent 3f46de71bf
commit 51b6598747
6 changed files with 97 additions and 18 deletions

View File

@ -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 <Skill>
* <Skill> 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 <Skill>.
* <Skill> 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 <Skill> 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:

View File

@ -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() != "") {

View File

@ -47,8 +47,15 @@
<tr>
<td class="text-left"><a href="{% url 'event_details' event.id %}">{{ event.name }}</a></td>
<td class="text-center">{{ event.date_begin | date:"d-m-Y"}}</td>
<td class="text-center">{% if event.number_of_week_from_today < 0 %}{{event.number_of_week_from_today}}{% else %}<span class="text-{% if event.number_of_week_from_today > 12 %}success{% elif event.number_of_week_from_today > 9 %}info{% elif event.number_of_week_from_today > 6 %}warning{% else %}danger{% endif %}">
<b>{{event.number_of_week_from_today}}</b></span>{% endif %}</td>
<td class="text-center">
{% if event.number_of_week_from_today < 0 %}
{{event.number_of_week_from_today}}
{% else %}
<span class="text-{% if event.number_of_week_from_today > 12 %}success{% elif event.number_of_week_from_today > 9 %}info{% elif event.number_of_week_from_today > 6 %}warning{% else %}danger{% endif %}">
<b>{{event.number_of_week_from_today}}</b>
</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>

View File

@ -129,7 +129,9 @@
{% endif %}
<td>{{ plan.educative.skill.notation }}</td>
<td class="text-left">
<a href="{% url 'skill_details' plan.educative.id %}">{{ plan.educative.long_label }}</a>
<a href="{% url 'skill_details' plan.educative.id %}">
{{ plan.educative.long_label }}
</a>
</td>
<td class="text-left">
{{ plan.get_learning_step_display }}</a>
@ -185,7 +187,9 @@
</td>
{% endif %}
<td>{{ skill.notation }}</td>
<td class="text-left"><a href="{% url 'skill_details' skill.id %}">{{ skill.long_label }}</a></td>
<td class="text-left">
<a href="{% url 'skill_details' skill.id %}">{{ skill.long_label }}</a>
</td>
<td>{{ skill.difficulty }}</td>
<td>{{ skill.level }}</td>
<td>{{ skill.rank }}</td>

View File

@ -80,7 +80,7 @@ gymnast_urlpatterns = [
name="gymnast_report_export_for_season",
),
path(
r"report/comparison/<int:gymnast_id>/season/<str:season_source>/week/<int:week_source>/season/<str:season_target>/week/<int:week_target>",
r"report/comparison/<int:gymnast_id>/season/<str:season_source>/week/<int:week_source>/season/<str:season_target>/week/<int:week_target>/",
views_reports.generate_report_week_comparison,
name="gymnast_generate_report_week_comparison",
),

View File

@ -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)