Bug fix in Injury listing

This commit is contained in:
Gregory Trullemans 2023-10-11 14:35:53 +02:00
parent 0017918013
commit a7c794ed79
2 changed files with 31 additions and 14 deletions

View File

@ -31,7 +31,6 @@ class ChronoAdmin(admin.ModelAdmin):
list_display = ("date", "gymnast", "tof", "chrono_type")
readonly_fields = ("season", "week_number", "created_at", "updated_at")
list_filter = ("chrono_type", ("gymnast", RelatedDropdownFilter))
# list_filter = (("gymnast", RelatedDropdownFilter),)
autocomplete_fields = ("gymnast",)
date_hierarchy = "date"
related_search_fields = {"gymnast": ("last_name", "first_name")}
@ -139,7 +138,7 @@ class WellBeingAdmin(admin.ModelAdmin):
"muscle_soreness",
"informations",
)
readonly_fields = ("season", "week_number", "created_at", "updated_at")
readonly_fields = ("created_at", "updated_at")
list_display = (
"date",
"gymnast",
@ -148,6 +147,8 @@ class WellBeingAdmin(admin.ModelAdmin):
"stress",
"fatigue",
"muscle_soreness",
"created_at",
"updated_at",
)
list_filter = (
"date",

View File

@ -91,7 +91,7 @@
</td>
<td class="text-center"><a href="{% url 'injury_details' injury.id %}">{{ injury.date | date:"d-m-Y" }}</a></td>
<td class="text-left">{{ injury.get_mechanism_display }}</td>
<td class="text-left">{{ injury.type }}</td>
<td class="text-left">{{ injury.get_injury_type_display }}</td>
<td class="text-left">{{ injury.location }}</td>
<td class="text-left">{{ injury.get_body_side_display }}</td>
<td class="text-left">{% if injury.skill %}<a href="{% url 'skill_details' injury.skill.id %}">{{ injury.skill }}</a>{% else %}-{% endif %}</td>
@ -213,7 +213,7 @@
{% endif %}
{% if wellbeing_list %}
var ctx = document.getElementById("chart_mindstate").getContext("2d");
var ctx = document.getElementById("chart_wellbeing").getContext("2d");
var border_color_pink = 'rgb(255, 99, 132)';
var gradient_stroke_pink = ctx.createLinearGradient(0, 230, 0, 50);
@ -236,18 +236,25 @@
gradient_stroke_green.addColorStop(0.5, 'rgba(75, 192, 192, 0.2)');
gradient_stroke_green.addColorStop(0.25, 'rgba(75, 192, 192, 0)');
var border_color_4 = 'rgb(54, 162, 235)';
var gradient_stroke_4 = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_4.addColorStop(1, 'rgba(54, 162, 235, 0.4)');
gradient_stroke_4.addColorStop(0.75, 'rgba(54, 162, 235, 0.3)');
gradient_stroke_4.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)');
gradient_stroke_4.addColorStop(0.25, 'rgba(54, 162, 235, 0)');
var border_color_blue = 'rgb(54, 162, 235)';
var gradient_stroke_blue = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_blue.addColorStop(1, 'rgba(54, 162, 235, 0.4)');
gradient_stroke_blue.addColorStop(0.75, 'rgba(54, 162, 235, 0.3)');
gradient_stroke_blue.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)');
gradient_stroke_blue.addColorStop(0.25, 'rgba(54, 162, 235, 0)');
var border_color_yellow = 'rgb(255, 205, 86)';
var gradient_stroke_yellow = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_yellow.addColorStop(1, 'rgba(255, 205, 86, 0.4)');
gradient_stroke_yellow.addColorStop(0.75, 'rgba(255, 205, 86, 0.3)');
gradient_stroke_yellow.addColorStop(0.5, 'rgba(255, 205, 86, 0.2)');
gradient_stroke_yellow.addColorStop(0.25, 'rgba(255, 205, 86, 0)');
var mindstate_values = [
{% for wellbeing in wellbeing_list %}
{
x: '{{ wellbeing.date | date:"d-m-Y" }}',
y: '{{ wellbeing.mindstate }}'
y: '{{ wellbeing.mind_state }}'
},
{% endfor %}
];
@ -320,12 +327,21 @@
{
label: 'Fatigue',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_4,
borderColor: border_color_4,
pointBackgroundColor: border_color_4,
backgroundColor: gradient_stroke_blue,
borderColor: border_color_blue,
pointBackgroundColor: border_color_blue,
fill: true,
data: fatigue_values,
},
{
label: 'Muscle',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_yellow,
borderColor: border_color_yellow,
pointBackgroundColor: border_color_yellow,
fill: true,
data: muscle_soreness_values,
},
],
};