Merging and resolve conflicts
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Gregory Trullemans 2021-12-24 20:08:48 +01:00
commit d987e590cb
13 changed files with 144 additions and 106 deletions

View File

@ -4,8 +4,8 @@
<div class="card mb-0">
<div class="card-header">
<div class="row">
<div class="col-2">
<h4 class=""> Chronos listing</h4>
<div class="col-8">
<h4 class=""> Chronos listing {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">
@ -24,7 +24,7 @@
<table class="table table-striped table-condensed tablesorter" id="chrono_table">
<thead>
<tr>
<th style="width: 5%">&nbsp;</th>
<th style="width: 3%">&nbsp;</th>
<th style="width: 10%" class="header">Date</th>
<th style="width: 25%" class="header text-left">Gymnast</th>
<th style="width: 25%" class="header text-left">Routine</th>
@ -69,7 +69,7 @@
0: { sorter: false }, // disable first column
},
dateFormat: "uk",
sortList: [[3,0], [1,0]]
sortList: [[1,1], [2,1]]
})
});
</script>

View File

@ -5,7 +5,7 @@
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="card">
<div class="card-header">
<h4 class="">Height/Weight list</h4>
<h4 class="">Height/Weight list {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
</div>
<div class="card-body">
{% if heightweight_list %}

View File

@ -5,7 +5,7 @@
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="card">
<div class="card-header">
<h4 class="">Mind State list</h4>
<h4 class="">Mind State list {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
</div>
<div class="card-body">
{% if mindstate_list %}

View File

@ -5,7 +5,7 @@
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="card">
<div class="card-header">
<h4 class="">Routine done list</h4>
<h4 class="">Routine done list {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
</div>
<div class="card-body">
{% if routine_done_list %}

View File

@ -5,16 +5,17 @@
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="card">
<div class="card-header">
<h4 class="">Scores listing</h4>
<h4 class="">Scores listing {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
</div>
<div class="card-body">
{% if score_list.count >= 1 %}
{% if score_list %}
<table class="table tablesorter table-striped mb-0" data-sort="table" id="maintable">
<thead>
<tr>
<th></th>
<th class="header text-left">Gymnast</th>
<th class="header text-left">Event</th>
<th class="header text-left">Date</th>
<th class="header text-left">Routine</th>
<th class="header text-center">Exe.</th>
<th class="header text-center">Dif.</th>
@ -34,13 +35,14 @@
</td>
<td><a href="{% url 'gymnast_details' score.gymnast.id %}">{{ score.gymnast }}</a></td>
<td><a href="{% url 'event_details' score.event.id %}">{{ score.event.name }}</a></td>
<td>{{ score.event.datebegin | date:"d-m-Y" }}</td>
<td>{{ score.get_routine_type_display }}</td>
<td class="text-right">{{ score.point_execution }}</td>
<td class="text-right">{{ score.point_difficulty }}</td>
<td class="text-right">{{ score.point_time_of_flight }}</td>
<td class="text-right">{{ score.point_horizontal_displacement }}</td>
<td class="text-right">{% if score.penality > 0 %}-{{ score.penality }}{% endif %}</td>
<td class="text-right">{{ score.total }}</td>
<td class="text-right">{% if score.penality > 0 %}-{{ score.penality }}{% else %}-{% endif %}</td>
<td class="text-right"><b>{{ score.total }}</b></td>
</tr>
{% endfor %}
</tbody>

View File

@ -5,7 +5,7 @@
<div class="card-header">
<div class="row">
<div class="col-4">
<h4 class=""> Routines' Listing</h4>
<h4 class=""> Routines' Listing {% if gymnast_id %}for <i>{{ gymnast }}</i>{% endif %}</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">

View File

@ -1,90 +1,82 @@
<div class="row justify-content-center ml-3 pr-0">
<div class="col-md-12 pr-0">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h4>Routines</h4>
<h4>Actives Routines</h4>
</div>
<div class="card-body pt-0 pb-0">
{% if ghr_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
<thead>
<tr>
<!-- <th></th> -->
<th style="width: 5%" class="header text-center">Type</th>
<th style="width: 30%" class="header text-left">Label</th>
<th style="width: 10%" class="header text-center">From</th>
<th style="width: 10%" class="header text-center">To</th>
<th style="width: 5%" class="header text-center">Diff.</th>
<th style="width: 5%" class="header text-center">Level</th>
<th style="width: 5%" class="header text-center">Rank</th>
</tr>
</thead>
<tbody>
{% for ghr in ghr_list %}
<tr>
<!-- <td> -->
<!-- <a href="{% url 'routine_update' ghr.routine.id %}"> -->
<!-- <span class="tim-icons icon-pencil text-warning"></span> -->
<!-- </a> -->
<!-- </td> -->
<td class="text-center">{{ ghr.get_routine_type_display }}</td>
<td class="text-left"><a href="{% url 'routine_details' ghr.routine.id %}">{{ ghr.routine.long_label }}</a></td>
<td class="text-center">{{ ghr.datebegin | date:"d-m-Y"}}</td>
<td class="text-center">{% if ghr.dateend %}{{ ghr.dateend | date:"d F Y" }}{% else %}… to now.{% endif %}</td>
<td class="text-center">{{ ghr.routine.difficulty }}</td>
<td class="text-center">{{ ghr.routine.level }}</td>
<td class="text-center">{{ ghr.routine.rank }}</td>
</tr>
{% endfor %}
</tbody>
{% if ghr_list %}
<div class="card-body pt-0 pb-0 pr-1 pl-1">
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="routine_table">
<thead>
<tr>
<th style="width: 8%" class="header text-left">Type</th>
<th style="width: 30%" class="header text-left">Label</th>
<th style="width: 15%" class="header text-left">From</th>
<th style="width: 10%" class="header text-center">Diff.</th>
<th style="width: 10%" class="header text-center">Level</th>
<th style="width: 10%" class="header text-center">Rank</th>
</tr>
</thead>
<tbody>
{% for ghr in ghr_list %}
<tr>
<td class="text-center">{{ ghr.get_routine_type_display }}</td>
<td class="text-left"><a href="{% url 'routine_details' ghr.routine.id %}">{{ ghr.routine.short_label }}</a></td>
<td class="text-center">{{ ghr.datebegin | date:"d-m-Y"}}</td>
<!-- <td class="text-center">{% if ghr.dateend %}{{ ghr.dateend | date:"d F Y" }}{% else %}… to now.{% endif %}</td> -->
<td class="text-center">{{ ghr.routine.difficulty }}</td>
<td class="text-center">{{ ghr.routine.level }}</td>
<td class="text-center">{{ ghr.routine.rank }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">There are no routines associated to this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
<a href="{% url 'link_routine_to_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-simple-add"></i>
</button>
</a>
<div class="card-footer text-right text-muted pt-0">
<a href="{% url 'routine_list_for_gymnast' gymnast_id %}">
<button type="submit" value="list" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-components"></i> <!-- Routines -->
</button>
</a>
<a href="{% url 'link_routine_to_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-simple-add"></i>
</button>
</a>
</div>
</div>
</div>
</div>
<div class="col-md-12 pr-0">
<div class="card">
<div class="card-header">
<h4>Routine's statistics</h4>
</div>
<div class="card-body pt-0 pb-0">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h4>Routine's statistics</h4>
</div>
<div class="card-body pt-0 pb-0 pr-1 pl-1">
{% if routine_done_list %}
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="stats_table">
<thead>
<tr>
<th style="width: 3%"></th>
<th style="width: 33%" class="header text-left">Routine</th>
<th style="width: 16%" class="header text-center">Type</th>
<th style="width: 16%" class="header text-center">Date</th>
<th style="width: 16%" class="header text-center"># Try</th>
<th style="width: 16%" class="header text-center"># Success</th>
<th style="width: 15%" class="header text-center">Date</th>
<th style="width: 30%" class="header text-left">Routine</th>
<th style="width: 8%" class="header text-center">Type</th>
<th style="width: 10%" class="header text-center"># Try</th>
<th style="width: 12%" class="header text-center"># Success</th>
</tr>
</thead>
<tbody>
{% for routinedone in routine_done_list %}
<tr>
<td>
<a href="{% url 'routinedone_update' routinedone.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<td class="text-left"><a href="{% url 'routine_details' routinedone.routine.id %}">{{ routinedone.routine.long_label }}</a></td>
<td class="text-center">{{ routinedone.get_routine_type_display }}</td>
<td class="text-center">{{ routinedone.date | date:"d-m-Y"}}</td>
<td class="text-center">{{ routinedone.number_of_try }}</td>
<td class="text-center">{{ routinedone.number_of_successes }}</td>
<td class="text-center">{{ record.date | date:"d-m-Y"}}</td>
<td class="text-left"><a href="{% url 'routine_details' record.routine.id %}">{{ record.routine.long_label }}</a></td>
<td class="text-center">{{ record.get_routine_type_display }}</td>
<td class="text-center">{{ record.number_of_try }}</td>
<td class="text-center">{{ record.number_of_successes }}</td>
</tr>
{% endfor %}
</tbody>
@ -95,6 +87,12 @@
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
<a href="{% url 'routinedone_list_for_gymnast' gymnast_id %}">
<button type="submit" value="list" class="btn btn-icon btn-warning ">
<i class="fal fa-chart-bar"></i>
</button>
</a>
<a href="{% url 'routinedone_create_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-simple-add"></i>
@ -107,12 +105,20 @@
<script type="text/javascript">
$(document).ready(function() {
$('[data-sort="table"]').tablesorter({
headers: {
0: { sorter: false }, // disable first column
},
$('#routine_table').tablesorter({
// headers: {
// 0: { sorter: false }, // disable first column
// },
dateFormat: "uk",
sortList: [[2,1], ]
sortList: [[0,0], ]
})
$('#stats_table').tablesorter({
// headers: {
// 0: { sorter: false }, // disable first column
// },
dateFormat: "uk",
sortList: [[0,0], ]
})
});
</script>

View File

@ -126,5 +126,10 @@ routinedone_urlpatterns = [
views.routinedone_create_or_update,
name="routinedone_update",
),
path(r"", views.routine_done_listing, name="routine_done_listing"),
path(
r"gymnast/<int:gymnast_id>/",
views.routine_done_listing,
name="routinedone_list_for_gymnast",
),
path(r"", views.routine_done_listing, name="routinedone_list"),
]

View File

@ -35,12 +35,14 @@ import simplejson
def chrono_listing(request, gymnast_id=None):
"""Récupère la liste des chronos"""
gymnast = None
if gymnast_id:
chrono_list = Chrono.objects.filter(gymnast=gymnast_id)
gymnast = Gymnast.objects.get(pk=gymnast_id)
else:
chrono_list = Chrono.objects.all()
context = {"chrono_list": chrono_list}
context = {"chrono_list": chrono_list, "gymnast": gymnast}
return render(request, "followup/chronos/list.html", context)
@ -104,7 +106,7 @@ def gymnast_learn_skill(request):
cando = request.POST.get("cando", 0)
if gymnast_id and skillid:
gymnast = Gymnast.objects.get(pk=gymnast_id)
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
skill = Skill.objects.get(pk=skillid)
ls = LearnedSkill(
gymnast=gymnast, skill=skill, cando=cando, date=datetime.now()
@ -197,17 +199,20 @@ def score_listing(request, gymnast_id=None):
"""
pattern = request.GET.get("pattern", None)
gymnast = None
if pattern:
score_list = Point.objects.filter(
Q(event__icontains=pattern) | Q(gymnast__icontains=pattern)
Q(event__icontains=pattern)
| Q(gymnast__icontains=pattern)
)
elif gymnast_id:
score_list = Point.objects.filter(gymnast=gymnast_id)
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
else:
score_list = Point.objects.all()
context = {"score_list": score_list}
context = {"score_list": score_list, "gymnast": gymnast}
return render(request, "followup/scores/list.html", context)
@ -285,15 +290,16 @@ def accident_detail(request, accidentid):
@require_http_methods(["GET"])
def mindstate_listing(request, gymnast_id=None):
"""
Récupère la liste des evaluations mentales suivant (d'un gymnast si définit en paramètre).
Récupère la liste des évaluations mentales suivant (d'un gymnaste si définit en paramètre).
"""
gymnast = None
if gymnast_id:
mindstate_list = MindState.objects.filter(gymnast=gymnast_id)
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
else:
mindstate_list = MindState.objects.all()
context = {"mindstate_list": mindstate_list}
context = {"mindstate_list": mindstate_list, "gymnast": gymnast}
return render(request, "followup/mindstates/list.html", context)
@ -354,13 +360,14 @@ def heightweight_listing(request, gymnast_id=None):
"""
Récupère la liste des couples taille/poids suivant (d'un gymnast si définit en paramètre).
"""
gymnast = None
if gymnast_id:
heightweight_list = HeightWeight.objects.filter(gymnast=gymnast_id)
gymnast = Gymnast.objects.get(pk=gymnast_id)
else:
heightweight_list = HeightWeight.objects.all()
context = {"heightweight_list": heightweight_list}
context = {"heightweight_list": heightweight_list, "gymnast": gymnast}
return render(request, "followup/heightweight/list.html", context)
@ -402,12 +409,18 @@ def heightweight_create_or_update(request, heightweight_id=None, gymnast_id=None
@login_required
@require_http_methods(["GET"])
def routine_done_listing(request):
def routine_done_listing(request, gymnast_id=None):
"""
Liste tous les record de la table NumberOfRoutineDone
"""
routine_done_list = NumberOfRoutineDone.objects.all()
context = {"routine_done_list": routine_done_list}
gymnast = None
if gymnast_id:
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
routine_done_list = gymnast.number_of_routine_done.all()
else:
routine_done_list = NumberOfRoutineDone.objects.all()
context = {"routine_done_list": routine_done_list, "gymnast": gymnast}
return render(request, "followup/routinedone/list.html", context)

View File

@ -142,7 +142,9 @@ def club_lookup(request):
if pattern is not None and len(pattern) > 3:
model_results = Club.objects.filter(
Q(name__icontains=pattern) | Q(place__city__icontains=pattern) | Q(acronym__icontains=pattern)
Q(name__icontains=pattern)
| Q(place__city__icontains=pattern)
| Q(acronym__icontains=pattern)
)
results = [{"ID": x.id, "Name": str(x)} for x in model_results]

View File

@ -38,6 +38,7 @@ routine_urlpatterns = [
# ),
# path(r"suggest/", views.suggest_routine, name="suggest_routine",),
path(r"", views.routine_listing, name="routine_list"),
path(r"gymnast/<int:gymnast_id>", views.routine_listing, name="routine_list_for_gymnast"),
]
# Plan

View File

@ -26,7 +26,8 @@ def skill_lookup(request):
# Ignore queries shorter than length 2
if pattern is not None and len(pattern) > 2:
model_results = Skill.objects.filter(
Q(short_label__icontains=pattern) | Q(long_label__icontains=pattern)
Q(short_label__icontains=pattern)
| Q(long_label__icontains=pattern)
)
results = [
{"ID": x.id, "Name": str(x), "Notation": x.notation} for x in model_results
@ -50,7 +51,8 @@ def skill_listing(request, field=None, expression=None, value=None, level=None):
if pattern:
skill_list = Skill.objects.filter(
Q(long_label__icontains=pattern) | Q(short_label__icontains=pattern)
Q(long_label__icontains=pattern)
| Q(short_label__icontains=pattern)
)
elif field and expression and value:
kwargs = {"{0}__{1}".format(field, expression): value}
@ -99,20 +101,26 @@ def skill_details(request, skillid):
@login_required
@require_http_methods(["GET"])
def routine_listing(request):
def routine_listing(request, gymnast_id=None):
"""
Récupère la liste des routines (série) suivant un pattern si celui-ci est définit.
"""
gymnast = None
pattern = request.GET.get("pattern", None)
if pattern:
routine_list = Routine.objects.filter(
Q(long_label__icontains=pattern) | Q(short_label__icontains=pattern)
Q(long_label__icontains=pattern)
| Q(short_label__icontains=pattern)
)
else:
routine_list = Routine.objects.all()
if gymnast_id:
routine_list = Routine.objects.filter(done_by_gymnast__gymnast=gymnast_id)
gymnast = Gymnast.objects.get(pk=gymnast_id)
else:
routine_list = Routine.objects.all()
context = {"routine_list": routine_list}
context = {"routine_list": routine_list, "gymnast_id": gymnast_id, "gymnast": gymnast}
return render(request, "objectives/routines/list.html", context)
@ -126,7 +134,8 @@ def routine_lookup(request):
if pattern is not None and len(pattern) >= 3:
results = Routine.objects.filter(
Q(long_label__icontains=pattern) | Q(short_label__icontains=pattern)
Q(long_label__icontains=pattern)
| Q(short_label__icontains=pattern)
)
place_list = [{"id": x.id, "label": str(x)} for x in results]

View File

@ -294,8 +294,8 @@ def gymnast_display_routines(request, gymnast_id):
Tag affichant les séries d'un gymnaste.
"""
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
ghr_list = gymnast.has_routine.prefetch_related("routine")
routine_done_list = NumberOfRoutineDone.objects.filter(gymnast = gymnast_id).order_by("-date")
ghr_list = gymnast.has_routine.prefetch_related("routine").filter(dateend__isnull=True)
routine_done_list = NumberOfRoutineDone.objects.filter(gymnast = gymnast_id).order_by("-date")[:8]
context = {"ghr_list": ghr_list, "routine_done_list": routine_done_list, "gymnast_id": gymnast_id}
return render(request, "peoples/gymnasts/list_routine.html", context)