Fix bug into routine compute_informations function

This commit is contained in:
Gregory Trullemans 2024-02-20 14:12:19 +01:00
parent 75599d32c5
commit eeb638291a
2 changed files with 19 additions and 18 deletions

View File

@ -299,7 +299,7 @@ class Routine(Educative):
age_boy_masterised = 0
age_girl_masterised = 0
difficulty = 0
is_routine = False
# is_routine = False
is_competitive = True
for skill_link in self.skill_links.all():
@ -338,8 +338,10 @@ class Routine(Educative):
skill.age_girl_masterised, age_girl_masterised
)
if self.skill_links.all().count() < 5:
is_routine = False
# Je ne sais plus pourquoi j'ai mis ce bout de code.
# if self.skill_links.all().count() < 5:
# is_routine = False
# print("Not a routine.")
if not self.is_routine:
is_competitive = False
@ -347,7 +349,7 @@ class Routine(Educative):
if self.skill_links.all().count() != 10:
is_competitive = False
self.is_routine = is_routine
# self.is_routine = is_routine
self.is_competitive = is_competitive
self.difficulty = difficulty

View File

@ -33,26 +33,25 @@
<div class="col-3 text-center">Age Boy : <a href="#">{{ routine.age_boy_masterised }}</a></div>
<div class="col-3 text-center">Age Girl : <a href="#">{{ routine.age_girl_masterised }}</a></div>
</div>
<div class="row">
<div class="col-6 text-center">Routine : <a href="#">{{ routine.is_routine }}</a></div>
<div class="col-6 text-center">Competition : <a href="#">{{ routine.is_competitive }}</a></div>
<div class="row mt-2">
<div class="col-6 text-center">Routine : <a href="#">{% if routine.is_routine %}Yes{% else %}No{% endif %}</a></div>
<div class="col-6 text-center">Competition : <a href="#">{% if routine.is_competitive %}Yes{% else %}No{% endif %}</a></div>
</div>
{% else %}
<p>No skill defined for this routine.</p>
{% endif %}
{% if routine.informations %}
<div class="col-md-12">
<hr class="m-t">
<h5><b>Informations</b></h5>
<!-- <p>{{ skill.educative }}</p> -->
<span id="comment">
{{ routine.to_markdown | safe }}
</span>
</div>
{% endif %}
</div>
{% if routine.informations %}
<div class="col-md-12">
<hr class="m-t">
<h4>Informations</h4>
<!-- <p>{{ skill.educative }}</p> -->
<span id="comment">
{{ routine.to_markdown | safe }}
</span>
</div>
{% endif %}
<div class="card-footer row pt-0">
<div class="col-6">
<a href="{% url 'routine_listing' %}">