Add person graphs endpoint for workouts per week & PRs per week, consumed via dashboard, person overview and notes

This commit is contained in:
Peter Stockings
2025-01-27 01:00:50 +11:00
parent 049af675cc
commit 0ed0c20e93
9 changed files with 224 additions and 152 deletions

View File

@@ -2,12 +2,9 @@
{% block content %}
<div class="w-full mb-4 grid grid-cols-1 xl:grid-cols-2 gap-4">
{% for graph in dashboard_graphs %}
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8">
{{ render_partial('partials/svg_line_graph.html', **graph) }}
</div>
{% endfor %}
<div class="hidden" hx-get="{{ url_for('get_people_graphs') }}"
hx-include="[name='exercise_id'],[name='min_date'],[name='max_date'],[name='person_id']" hx-trigger="load"
hx-target="this" hx-swap="outerHTML">
</div>
<div class="bg-white shadow rounded-lg pt-4 p-3 md:p-4 w-full mb-4">

View File

@@ -3,6 +3,10 @@
{% block content %}
<div class="flex flex-grow flex-col bg-white sm:rounded shadow overflow-hidden">
<div class="hidden" hx-get="{{ url_for('get_people_graphs') }}" hx-vals='{"person_id": "{{ person_id }}"}'
hx-trigger="load" hx-target="this" hx-swap="outerHTML">
</div>
<div class="flex items-center justify-between pt-2 pb-2">
<div class="flex">
<h2 class="ml-2 text-xl font-bold leading-none">Notes</h2>

View File

@@ -0,0 +1,8 @@
<div class="w-full mb-4 grid grid-cols-1 xl:grid-cols-2 gap-4" hx-get="{{ refresh_url }}" hx-target="this"
hx-swap="outerHTML" hx-trigger="refreshStats from:body">
{% for graph in graphs %}
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8">
{{ render_partial('partials/svg_line_graph.html', **graph) }}
</div>
{% endfor %}
</div>

View File

@@ -65,7 +65,7 @@
{% endfor %}
</svg>
{% if plots|length > 1 %}
<div class="flex justify-center pt-2">
{% for plot in plots %}
<div class="flex items-center px-2 select-none cursor-pointer"
@@ -76,6 +76,5 @@
</div>
{% endfor %}
</div>
{% endif %}
</div>

View File

@@ -5,6 +5,11 @@
<div class="flex max-w-full overflow-x-hidden">
<div class="bg-white shadow rounded-lg pt-2 pb-2 sm:w-full xl:p-8 md:w-full">
<div class="hidden" hx-get="{{ url_for('get_people_graphs') }}"
hx-include="[name='exercise_id'],[name='min_date'],[name='max_date']"
hx-vals='{"person_id": "{{ person_id }}"}' hx-trigger="load" hx-target="this" hx-swap="outerHTML">
</div>
<div class="mb-4 flex items-center justify-between px-2 md:px-3">
<div>
<h3 class="text-xl font-bold text-gray-900 mb-2">{{ person_name }}</h3>