Compare commits
No commits in common. "99cd1d01e6ddab52b1000367d52f47ab90878293" and "b8fa28d2257abd1c394f3ed3cf97cd6cfa4f0bb6" have entirely different histories.
99cd1d01e6
...
b8fa28d225
|
@ -136,11 +136,7 @@
|
|||
{% if wellbeing_state %}
|
||||
<span class="text-{{ wellbeing_state }}">
|
||||
{% endif %}
|
||||
{% if wellbeing_last_record_date %}
|
||||
{{ wellbeing_last_record_date.0 |date:"j F Y" }}
|
||||
{% else %}
|
||||
Never
|
||||
{% endif %}
|
||||
{{ wellbeing_last_record_date.0 |date:"j F Y" }}
|
||||
{% if wellbeing_state %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
@ -150,11 +146,7 @@
|
|||
{% if height_weight_state %}
|
||||
<span class="text-{{ height_weight_state }}">
|
||||
{% endif %}
|
||||
{% if height_weight_last_record_date %}
|
||||
{{ height_weight_last_record_date.0 |date:"j F Y" }}
|
||||
{% else %}
|
||||
Never
|
||||
{% endif %}
|
||||
{{ height_weight_last_record_date.0 |date:"j F Y" }}
|
||||
{% if wellbeing_state %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
@ -164,11 +156,7 @@
|
|||
{% if intensity_state %}
|
||||
<span class="text-{{ intensity_state }}">
|
||||
{% endif %}
|
||||
{% if intensities_last_record_date %}
|
||||
{{ intensities_last_record_date.0 |date:"j F Y" }}
|
||||
{% else %}
|
||||
Never
|
||||
{% endif %}
|
||||
{{ intensities_last_record_date.0 |date:"j F Y" }}
|
||||
{% if wellbeing_state %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
@ -179,11 +167,7 @@
|
|||
{% if chrono_state %}
|
||||
<span class="text-{{ chrono_state }}">
|
||||
{% endif %}
|
||||
{% if chrono_last_record_date %}
|
||||
{{ chrono_last_record_date.0 |date:"j F Y" }}
|
||||
{% else %}
|
||||
Never
|
||||
{% endif %}
|
||||
{{ chrono_last_record_date.0 |date:"j F Y" }}
|
||||
{% if chrono_state %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
@ -193,11 +177,7 @@
|
|||
{% if known_skills_state %}
|
||||
<span class="text-{{ known_skills_state }}">
|
||||
{% endif %}
|
||||
{% if known_skills_last_record_date %}
|
||||
{{ known_skills_last_record_date.0 |date:"j F Y" }}
|
||||
{% else %}
|
||||
Never
|
||||
{% endif %}
|
||||
{{ known_skills_last_record_date.0 |date:"j F Y" }}
|
||||
{% if known_skills_state %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
|
|
@ -201,56 +201,56 @@ def home(request):
|
|||
# print("Pas son annif…")
|
||||
|
||||
wellbeing_last_record_date = WellBeing.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
wellbeing_state = None
|
||||
if wellbeing_last_record_date:
|
||||
if todate.diff(wellbeing_last_record_date[0]).in_days() > 21:
|
||||
wellbeing_state = "danger bold"
|
||||
elif todate.diff(wellbeing_last_record_date[0]).in_days() > 14:
|
||||
wellbeing_state = "danger"
|
||||
elif todate.diff(wellbeing_last_record_date[0]).in_days() > 7:
|
||||
wellbeing_state = "warning"
|
||||
|
||||
if todate.diff(wellbeing_last_record_date[0]).in_days() > 21:
|
||||
wellbeing_state = "danger bold"
|
||||
elif todate.diff(wellbeing_last_record_date[0]).in_days() > 14:
|
||||
wellbeing_state = "danger"
|
||||
elif todate.diff(wellbeing_last_record_date[0]).in_days() > 7:
|
||||
wellbeing_state = "warning"
|
||||
else:
|
||||
wellbeing_state = None
|
||||
|
||||
height_weight_last_record_date = HeightWeight.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
height_weight_state = None
|
||||
if height_weight_last_record_date:
|
||||
if todate.diff(height_weight_last_record_date[0]).in_days() > 21:
|
||||
height_weight_state = "danger bold"
|
||||
elif todate.diff(height_weight_last_record_date[0]).in_days() > 14:
|
||||
height_weight_state = "danger"
|
||||
elif todate.diff(height_weight_last_record_date[0]).in_days() > 7:
|
||||
height_weight_state = "warning"
|
||||
|
||||
if todate.diff(height_weight_last_record_date[0]).in_days() > 21:
|
||||
height_weight_state = "danger bold"
|
||||
elif todate.diff(height_weight_last_record_date[0]).in_days() > 14:
|
||||
height_weight_state = "danger"
|
||||
elif todate.diff(height_weight_last_record_date[0]).in_days() > 7:
|
||||
height_weight_state = "warning"
|
||||
else:
|
||||
height_weight_state = None
|
||||
|
||||
intensities_last_record_date = Intensity.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
intensity_state = None
|
||||
if intensities_last_record_date:
|
||||
if todate.diff(intensities_last_record_date[0]).in_days() > 21:
|
||||
intensity_state = "danger bold"
|
||||
elif todate.diff(intensities_last_record_date[0]).in_days() > 14:
|
||||
intensity_state = "danger"
|
||||
elif todate.diff(intensities_last_record_date[0]).in_days() > 7:
|
||||
intensity_state = "warning"
|
||||
if todate.diff(intensities_last_record_date[0]).in_days() > 21:
|
||||
intensity_state = "danger bold"
|
||||
elif todate.diff(intensities_last_record_date[0]).in_days() > 14:
|
||||
intensity_state = "danger"
|
||||
elif todate.diff(intensities_last_record_date[0]).in_days() > 7:
|
||||
intensity_state = "warning"
|
||||
else:
|
||||
intensity_state = None
|
||||
|
||||
# points_last_update = Gymnast.objects.all().order_by("-date")[:1]
|
||||
chrono_last_record_date = Chrono.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
chrono_state = None
|
||||
if chrono_last_record_date:
|
||||
if todate.diff(chrono_last_record_date[0]).in_days() > 21:
|
||||
chrono_state = "danger bold"
|
||||
elif todate.diff(chrono_last_record_date[0]).in_days() > 14:
|
||||
chrono_state = "danger"
|
||||
elif todate.diff(chrono_last_record_date[0]).in_days() > 7:
|
||||
chrono_state = "warning"
|
||||
if todate.diff(chrono_last_record_date[0]).in_days() > 21:
|
||||
chrono_state = "danger bold"
|
||||
elif todate.diff(chrono_last_record_date[0]).in_days() > 14:
|
||||
chrono_state = "danger"
|
||||
elif todate.diff(chrono_last_record_date[0]).in_days() > 7:
|
||||
chrono_state = "warning"
|
||||
else:
|
||||
chrono_state = None
|
||||
|
||||
known_skills_last_record_date = LearnedSkill.objects.filter(gymnast=gymnast).values_list("date").order_by("-date").first()
|
||||
known_skills_state = None
|
||||
if known_skills_last_record_date:
|
||||
if todate.diff(known_skills_last_record_date[0]).in_days() > 21:
|
||||
known_skills_state = "danger bold"
|
||||
elif todate.diff(known_skills_last_record_date[0]).in_days() > 14:
|
||||
known_skills_state = "danger"
|
||||
elif todate.diff(known_skills_last_record_date[0]).in_days() > 7:
|
||||
known_skills_state = "warning"
|
||||
if todate.diff(known_skills_last_record_date[0]).in_days() > 21:
|
||||
known_skills_state = "danger bold"
|
||||
elif todate.diff(known_skills_last_record_date[0]).in_days() > 14:
|
||||
known_skills_state = "danger"
|
||||
elif todate.diff(known_skills_last_record_date[0]).in_days() > 7:
|
||||
known_skills_state = "warning"
|
||||
else:
|
||||
known_skills_state = None
|
||||
|
||||
context["wellbeing_last_record_date"] = wellbeing_last_record_date
|
||||
context["wellbeing_state"] = wellbeing_state
|
||||
|
|
|
@ -107,8 +107,6 @@ def intensity_details(request, intensity_id):
|
|||
if not request.user.is_superuser and (
|
||||
request.session.has_key("available_gymnast")
|
||||
and intensity.gymnast.id not in request.session["available_gymnast"]
|
||||
) and (
|
||||
intensity.gymnast.id != request.user.gymnast.id
|
||||
):
|
||||
return intensity_listing(request)
|
||||
|
||||
|
|
|
@ -316,10 +316,8 @@ def wellbeing_details(request, wellbeing_id):
|
|||
if not request.user.is_superuser and (
|
||||
request.session.has_key("available_gymnast")
|
||||
and wellbeing.gymnast.id not in request.session["available_gymnast"]
|
||||
) and (
|
||||
wellbeing.gymnast.id != request.user.gymnast.id
|
||||
):
|
||||
return HttpResponseRedirect(reverse("wellbeing_list"))
|
||||
return wellbeing_listing(request)
|
||||
|
||||
return render(request, "wellbeing/details.html", {"wellbeing": wellbeing})
|
||||
|
||||
|
|
Loading…
Reference in New Issue