Update gymnast dashboard
This commit is contained in:
parent
4ec24b630d
commit
c910374a1b
|
@ -106,8 +106,8 @@
|
|||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{% if is_trainer %}
|
||||
<div class="card">
|
||||
{% if is_trainer %}
|
||||
<div class="card-header">
|
||||
<h4><i class="fal fa-exclamation-triangle text-danger"></i> Updated needed</h4>
|
||||
</div>
|
||||
|
@ -125,8 +125,22 @@
|
|||
No update needed.
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card-header">
|
||||
<h4><i class="fal fa-exclamation-triangle text-danger"></i> Your last profile update</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0">
|
||||
<ol class="list-unstyled">
|
||||
<li>Wellbeing: <i>{{ wellbeing_last_update.0 |date:"j F Y" }}</i></li>
|
||||
<li>Height/Weight: <i>{{ height_weight_last_update.0 |date:"j F Y" }}</i></li>
|
||||
<li>Intensity: <i>{{ intensities_last_update.0 |date:"j F Y" }}</i></li>
|
||||
<!-- <li>{{ points_last_update }}</li> -->
|
||||
<li>Chrono: <i>{{ chronos_last_update.0 |date:"j F Y" }}</i></li>
|
||||
<li>Learned Skill: <i>{{ known_skills_last_update.0 |date:"j F Y" }}</i></li>
|
||||
</ol>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
|
|
@ -5,7 +5,7 @@ import pendulum
|
|||
from django.db.models import Max
|
||||
from django.conf import settings
|
||||
from django.db.models import Q, F, OuterRef, Subquery
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.utils import timezone
|
||||
from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
|
@ -17,7 +17,15 @@ from django.contrib.auth import get_user_model
|
|||
|
||||
from jarvis.objective.models import Routine
|
||||
from jarvis.profiles.models import Profile
|
||||
from jarvis.followup.models import Skill, Point, Chrono
|
||||
from jarvis.followup.models import (
|
||||
Skill,
|
||||
Point,
|
||||
Chrono,
|
||||
WellBeing,
|
||||
Intensity,
|
||||
HeightWeight,
|
||||
LearnedSkill
|
||||
)
|
||||
from jarvis.location.models import Place, Club
|
||||
from jarvis.people.models import Gymnast
|
||||
from jarvis.people.views import gymnast_details
|
||||
|
@ -142,9 +150,22 @@ def home(request):
|
|||
)
|
||||
.distinct()
|
||||
)
|
||||
wellbeing_last_update = None
|
||||
height_weight_last_update = None
|
||||
intensities_last_update = None
|
||||
# points_last_update = None
|
||||
chronos_last_update = None
|
||||
# known_skills_last_update = None
|
||||
else:
|
||||
gymnast = get_object_or_404(Gymnast, pk=request.user.gymnast.id)
|
||||
last_updated_gymnasts = None
|
||||
waiting_update_gymnast = None
|
||||
wellbeing_last_update = WellBeing.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
height_weight_last_update = HeightWeight.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
intensities_last_update = Intensity.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
# points_last_update = Gymnast.objects.all().order_by("-date")[:1]
|
||||
chronos_last_update = Chrono.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
known_skills_last_update = LearnedSkill.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
|
||||
# TODO: véririer si c'est l'anniversaire de la personne qui est connectée.
|
||||
|
||||
|
@ -186,6 +207,12 @@ def home(request):
|
|||
"nb_routine": nb_routine,
|
||||
"nb_score": nb_score,
|
||||
"nb_club": nb_club,
|
||||
"wellbeing_last_update": wellbeing_last_update,
|
||||
"height_weight_last_update": height_weight_last_update,
|
||||
"intensities_last_update": intensities_last_update,
|
||||
# "points_last_update": points_last_update,
|
||||
"chronos_last_update": chronos_last_update,
|
||||
"known_skills_last_update": known_skills_last_update,
|
||||
"percentage_week": percentage_week,
|
||||
"birthday_list": birthday_list,
|
||||
"is_trainer": is_trainer,
|
||||
|
|
Loading…
Reference in New Issue