From 68f807650ef9a57c801242b268a17aea5808bb66 Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Wed, 12 Oct 2022 17:21:27 +0200 Subject: [PATCH] Add link to tab --- templates/followup/accidents/list.html | 2 +- templates/followup/learnedskills/create.html | 8 ++++---- templates/followup/plan/create.html | 8 ++++---- templates/people/gymnasts/tab_skill.html | 2 +- templates/ultron/dashboard/dashboard.html | 2 +- ultron/followup/admin.py | 4 ++-- ultron/followup/forms.py | 8 ++++---- ultron/followup/models.py | 6 +++--- ultron/followup/views.py | 4 ++-- ultron/people/templatetags/skill_doughnut.py | 4 ++-- ultron/people/views.py | 16 ++++++++-------- ultron/tools/pdf_generator.py | 4 ++-- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/templates/followup/accidents/list.html b/templates/followup/accidents/list.html index c0e667a17c..3bf0a409b9 100644 --- a/templates/followup/accidents/list.html +++ b/templates/followup/accidents/list.html @@ -40,7 +40,7 @@ {{ accident.date | date:"d-m-Y" }} - {{ accident.gymnast }} + {{ accident.gymnast }} {% if accident.skill %} {{ accident.skill }} diff --git a/templates/followup/learnedskills/create.html b/templates/followup/learnedskills/create.html index f9f074eef4..dcb78b0a4c 100644 --- a/templates/followup/learnedskills/create.html +++ b/templates/followup/learnedskills/create.html @@ -42,10 +42,10 @@
- -
- {{ form.cando }} - {% if form.cando.errors %} {% for error in form.cando.errors %}{{error}}{% endfor %}{% endif %} + +
+ {{ form.learning_step }} + {% if form.learning_step.errors %} {% for error in form.learning_step.errors %}{{error}}{% endfor %}{% endif %}
{% if plan_id %} diff --git a/templates/followup/plan/create.html b/templates/followup/plan/create.html index 189e68fb14..9a61a7f3e6 100644 --- a/templates/followup/plan/create.html +++ b/templates/followup/plan/create.html @@ -41,10 +41,10 @@
- -
- {{ form.cando }} - {% if form.cando.errors %} {% for error in form.cando.errors %}{{error}}{% endfor %}{% endif %} + +
+ {{ form.learning_step }} + {% if form.learning_step.errors %} {% for error in form.learning_step.errors %}{{error}}{% endfor %}{% endif %}
diff --git a/templates/people/gymnasts/tab_skill.html b/templates/people/gymnasts/tab_skill.html index f8018e3da0..4432f73e81 100644 --- a/templates/people/gymnasts/tab_skill.html +++ b/templates/people/gymnasts/tab_skill.html @@ -451,7 +451,7 @@ data: { gymnast_id: $(this).data('gymnastid'), skill_id: $(this).data('skillid'), - cando: $(this).data('link'), + learning_step: $(this).data('link'), csrfmiddlewaretoken: '{{ csrf_token }}' }, type: 'POST', diff --git a/templates/ultron/dashboard/dashboard.html b/templates/ultron/dashboard/dashboard.html index e918957723..a115e983c4 100644 --- a/templates/ultron/dashboard/dashboard.html +++ b/templates/ultron/dashboard/dashboard.html @@ -11,7 +11,7 @@

Hi {{ user.username }} !

- Welcome to Ultron v0.55 (last update : 7-10-2022)
+ Welcome to Ultron v0.57 (last update : 12-10-2022)
This application is here to help us to manage the gymnasts (evolution, evaluation, routines, scores, …). This tool is not perfect so feel free to make improvement proposals, bug reports, … by sending me an email.

diff --git a/ultron/followup/admin.py b/ultron/followup/admin.py index 35027989cb..9d62316c2e 100644 --- a/ultron/followup/admin.py +++ b/ultron/followup/admin.py @@ -46,12 +46,12 @@ class ChronoDetailsAdmin(admin.ModelAdmin): class LearnedSkillAdmin(admin.ModelAdmin): model = LearnedSkill - list_display = ("gymnast", "skill", "cando", "date") + list_display = ("gymnast", "skill", "learning_step", "date") readonly_fields = ('season', 'week_number', 'created_at', 'updated_at') list_filter = ( ('gymnast', RelatedDropdownFilter), ('skill', RelatedDropdownFilter), - "cando" + "learning_step" ) search_fields = ("gymnast", "skill") autocomplete_fields = ("gymnast", "skill") diff --git a/ultron/followup/forms.py b/ultron/followup/forms.py index f8e20dd064..8a3909bba2 100644 --- a/ultron/followup/forms.py +++ b/ultron/followup/forms.py @@ -52,7 +52,7 @@ class ChronoForm(forms.ModelForm): class LearnedSkillForm(forms.ModelForm): class Meta: model = LearnedSkill - fields = ("gymnast", "skill", "cando", "date") + fields = ("gymnast", "skill", "learning_step", "date") widgets = { "gymnast": forms.HiddenInput(), "skill": forms.HiddenInput(), @@ -63,7 +63,7 @@ class LearnedSkillForm(forms.ModelForm): "value": date.today().strftime("%Y-%m-%d"), } ), - "cando": forms.Select(attrs={"class": "form-control selectpicker"}), + "learning_step": forms.Select(attrs={"class": "form-control selectpicker"}), } gymnast_related = forms.CharField( @@ -441,7 +441,7 @@ class PlanForm(forms.ModelForm): class Meta: model = Plan - fields = ("date", "gymnast", "educative", "cando", "is_done") + fields = ("date", "gymnast", "educative", "learning_step", "is_done") widgets = { "gymnast": forms.HiddenInput(), "educative": forms.HiddenInput(), @@ -452,7 +452,7 @@ class PlanForm(forms.ModelForm): "value": date.today().strftime("%Y-%m-%d"), } ), - "cando": forms.Select(attrs={"class": "form-control selectpicker"}), + "learning_step": forms.Select(attrs={"class": "form-control selectpicker"}), "is_done": forms.CheckboxInput( attrs={"class": "form-control form-check-input ml-0 mt-0"} ), diff --git a/ultron/followup/models.py b/ultron/followup/models.py index dee347d4dc..e40ee5e5e1 100644 --- a/ultron/followup/models.py +++ b/ultron/followup/models.py @@ -148,7 +148,7 @@ class LearnedSkill(Seasonisable): class Meta: verbose_name = "Learned Skill" verbose_name_plural = "Learned Skills" - unique_together = ("gymnast", "skill", "date", "cando") + unique_together = ("gymnast", "skill", "date", "learning_step") gymnast = models.ForeignKey( Gymnast, @@ -162,7 +162,7 @@ class LearnedSkill(Seasonisable): related_name="known_by", on_delete=models.CASCADE, ) - cando = models.PositiveSmallIntegerField( + learning_step = models.PositiveSmallIntegerField( choices=LEARNING_STEP_CHOICES, verbose_name="Can do type" ) created_at = models.DateTimeField(auto_now_add=True) @@ -192,7 +192,7 @@ class Plan(Seasonisable): related_name="plan", on_delete=models.CASCADE, ) - cando = models.PositiveSmallIntegerField( + learning_step = models.PositiveSmallIntegerField( choices=LEARNING_STEP_CHOICES, verbose_name="Can do type", default=3 ) is_done = models.BooleanField(default=0) diff --git a/ultron/followup/views.py b/ultron/followup/views.py index 93298242e7..9e124d9c37 100644 --- a/ultron/followup/views.py +++ b/ultron/followup/views.py @@ -222,13 +222,13 @@ def gymnast_learn_skill(request): # utiliser un FORM pour cette fonction. gymnast_id = request.POST.get("gymnast_id", None) skill_id = request.POST.get("skill_id", None) - cando = request.POST.get("cando", 0) + learning_step = request.POST.get("learning_step", 0) if gymnast_id and skill_id: gymnast = get_object_or_404(Gymnast, pk=gymnast_id) skill = Skill.objects.get(pk=skill_id) learned_skill = LearnedSkill( - gymnast=gymnast, skill=skill, cando=cando, date=datetime.now() + gymnast=gymnast, skill=skill, learning_step=learning_step, date=datetime.now() ) learned_skill.save() return HttpResponse(status=200) diff --git a/ultron/people/templatetags/skill_doughnut.py b/ultron/people/templatetags/skill_doughnut.py index f2848e048f..e708859968 100644 --- a/ultron/people/templatetags/skill_doughnut.py +++ b/ultron/people/templatetags/skill_doughnut.py @@ -12,14 +12,14 @@ def generate_skill_doughnut(gymnast_id): with help or no) à la dernière date connue et les renvoie pour en faire un graphique. """ base_queryset = LearnedSkill.objects.filter(gymnast=gymnast_id).order_by("-date") - + total = 0 skills_capacity = [0] * 5 checked_skills = set() for learned_skill in base_queryset: if learned_skill not in checked_skills: checked_skills.add(learned_skill) - skills_capacity[learned_skill.cando] += 1 + skills_capacity[learned_skill.learning_step] += 1 total += 1 nb_skill = Skill.objects.all().count() diff --git a/ultron/people/views.py b/ultron/people/views.py index a0d682291e..352582997e 100644 --- a/ultron/people/views.py +++ b/ultron/people/views.py @@ -477,26 +477,26 @@ def gymnast_display_skill(request, gymnast_id): ).exclude(known_by__gymnast=gymnast.id) skill_whith_help = ( - Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=1) - .exclude(known_by__gymnast=gymnast.id, known_by__cando__gte=2) + Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__learning_step=1) + .exclude(known_by__gymnast=gymnast.id, known_by__learning_step__gte=2) .distinct() ) skill_without_help = ( - Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=2) - .exclude(known_by__gymnast=gymnast.id, known_by__cando=3) + Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__learning_step=2) + .exclude(known_by__gymnast=gymnast.id, known_by__learning_step=3) .distinct() ) skill_not_chained = ( - Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=2) - .exclude(known_by__gymnast=gymnast.id, known_by__cando=3) + Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__learning_step=2) + .exclude(known_by__gymnast=gymnast.id, known_by__learning_step=3) .distinct() ) skill_chained = ( - Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=3) - .exclude(known_by__gymnast=gymnast.id, known_by__cando=4) + Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__learning_step=3) + .exclude(known_by__gymnast=gymnast.id, known_by__learning_step=4) .distinct() ) diff --git a/ultron/tools/pdf_generator.py b/ultron/tools/pdf_generator.py index 3cff60ebf5..cfc068fcd2 100644 --- a/ultron/tools/pdf_generator.py +++ b/ultron/tools/pdf_generator.py @@ -550,14 +550,14 @@ class GymnastReportDocument(PDFDocument): | Q(plan__date__gte=date.today()) ) # .annotate(plan_date=F("plan__date")) - .annotate(plan_date=F("plan__date"), step=F("plan__cando")) + .annotate(plan_date=F("plan__date"), learning_step=F("plan__learning_step")) .order_by("notation", "-plan__date").distinct('notation')[:6] ) if planified_skills: for planified_skill in planified_skills: self.add_new_line( - X, planified_skill.short_label + " " + str(LEARNING_STEP_CHOICES[planified_skill.step][1]).lower() + " (" + planified_skill.notation + ") for " + planified_skill.plan_date.strftime("%d-%m-%Y") + X, planified_skill.short_label + " " + str(LEARNING_STEP_CHOICES[planified_skill.learning_step][1]).lower() + " (" + planified_skill.notation + ") for " + planified_skill.plan_date.strftime("%d-%m-%Y") ) else: self.add_new_line(