Le lien modérer "aujourd'hui" ne renvoie que sur les événements à venir

This commit is contained in:
Jean-Marie Favreau 2024-12-14 12:50:59 +01:00
parent 2c22d62302
commit 6ceec954d8
2 changed files with 6 additions and 1 deletions

View File

@ -40,7 +40,11 @@
<th class="label">reste à modérer</h>
{% for m in w %}
<td class="ratio score_{{ m.note }}">
<{% if m.not_moderated > 0 %}a href="{% url 'moderate_from_date' m.start_day.year m.start_day.month m.start_day.day %}"{% else %}span class="a"{% endif %}>
<{% if m.not_moderated > 0 %}a href="{% if m.is_today %}
{% url 'moderate' %}
{% else %}
{% url 'moderate_from_date' m.start_day.year m.start_day.month m.start_day.day %}
{% endif %}"{% else %}span class="a"{% endif %}>
{{ m.not_moderated }}<span class="total"> / {{ m.nb_events }}</span></{% if m.not_moderated > 0 %}a{% else %}span{% endif %}>
</td>
{% endfor %}

View File

@ -938,6 +938,7 @@ def administration(request):
# add missing dates
date_list = [today + timedelta(days=x) for x in range(0, nb_mod_days)]
nb_not_moderated = [{"start_day": d,
"is_today": d == today,
"nb_events": nb_not_moderated_dict[d][1] if d in nb_not_moderated_dict else 0,
"not_moderated": nb_not_moderated_dict[d][0] if d in nb_not_moderated_dict else 0} for d in date_list]
nb_not_moderated = [ x | { "note": 0 if x["not_moderated"] == 0 else int((nb_classes - 1) * x["not_moderated"] / max_not_moderated) + 1 } for x in nb_not_moderated]