Bug fix on dashboard week number

This commit is contained in:
Gregory Trullemans 2023-07-03 13:09:24 +02:00
parent 5bd76cc35a
commit 184ac55e44
2 changed files with 5 additions and 10 deletions

View File

@ -91,13 +91,9 @@ def home(request):
""" """
Génère la page d'accueil du site basée sur la saison (si celle-ci est connue) Génère la page d'accueil du site basée sur la saison (si celle-ci est connue)
""" """
# print("In home function") today = timezone.now() # pendulum.now().date()
today = pendulum.now().date()
_, week_number = from_date_to_week_number(today) _, week_number = from_date_to_week_number(today)
week_number = 42 event_list = Event.objects.filter(date_begin__gte=today).order_by("date_begin")[:10]
event_list = Event.objects.filter(date_begin__gte=timezone.now()).order_by(
"date_begin"
)[:10]
quote = Citation.objects.order_by("?").first() quote = Citation.objects.order_by("?").first()
@ -111,7 +107,7 @@ def home(request):
| Q(known_skills__created_at__gt=request.user.last_login) | Q(known_skills__created_at__gt=request.user.last_login)
).distinct() ).distinct()
limit_date = timezone.now() - timedelta(days=14) limit_date = today - timedelta(days=14)
waiting_update_gymnast = Gymnast.objects.exclude( waiting_update_gymnast = Gymnast.objects.exclude(
Q(is_active=False) Q(is_active=False)
| Q(mindstate__created_at__gte=limit_date) | Q(mindstate__created_at__gte=limit_date)
@ -163,7 +159,6 @@ def home(request):
"percentage_week": percentage_week, "percentage_week": percentage_week,
"birthday_list": birthday_list, "birthday_list": birthday_list,
} }
# print("out home function")
return render(request, "dashboard/dashboard.html", context) return render(request, "dashboard/dashboard.html", context)
# return render(request, "dashboard/dashboard.html", {}) # return render(request, "dashboard/dashboard.html", {})

View File

@ -42,10 +42,10 @@
<br /> <br />
{% endif %} {% endif %}
<li> <li>
<b>10 |</b> : {% if best_straightjump %}<b>{{ best_straightjump.0.tof }}</b> ({{ best_straightjump.0.date | date:"d-m-Y" }}{% else %} <span class="text-muted">no information</span>{% endif %} <b>10 |</b> : {% if best_straightjump %}<b>{{ best_straightjump.0.tof }}</b> ({{ best_straightjump.0.date | date:"d-m-Y" }}{% else %} <span class="text-muted">(no information)</span>{% endif %}
</li> </li>
<li> <li>
<b>Routine</b> : {% if best_routine %}<b>{{ best_routine.0.tof }}</b> ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} <span class="text-muted">no information</span>{% endif %} <b>Routine</b> : {% if best_routine %}<b>{{ best_routine.0.tof }}</b> ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} <span class="text-muted">(no information)</span>{% endif %}
</li> </li>
{% if user_is_trainer %} {% if user_is_trainer %}
<a href="{% url 'add_season_information_for_gymnast' gymnast.id %}">Add season details</a> - <a href="{% url 'add_season_information_for_gymnast' gymnast.id %}">Add season details</a> -