Fix issue where updating graph list for a workout would update all workouts

This commit is contained in:
Peter Stockings
2023-03-16 23:13:32 +11:00
parent 699390c28a
commit 9b43de849e
2 changed files with 4 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
<div class="flex justify-center pt-4 px-4"> <div class="flex justify-center pt-4 px-4">
<div class="mb-3 w-full md:w-1/3"> <div class="mb-3 w-full md:w-1/3">
<select id="multiSelection" data-te-select-init name="graph_types" class="mx-auto w-full" multiple <select id="multiSelection-{{ workout.id }}" data-te-select-init name="graph_types" class="mx-auto w-full" multiple
hx-trigger="change" hx-get="{{ url_for('view_workout', user_id=workout.user_id, workout_id=workout.id) }}" hx-trigger="change" hx-get="{{ url_for('view_workout', user_id=workout.user_id, workout_id=workout.id) }}"
hx-target="#workout_view"> hx-target="#workout_view-{{ workout.id }}">
<option value="cadence" {% if 'cadence' in graph_types %} selected {% endif%}>Cadence</option> <option value="cadence" {% if 'cadence' in graph_types %} selected {% endif%}>Cadence</option>
<option value="speed" {% if 'speed' in graph_types %} selected {% endif%}>Speed</option> <option value="speed" {% if 'speed' in graph_types %} selected {% endif%}>Speed</option>
<option value="power" {% if 'power' in graph_types %} selected {% endif%}>Power</option> <option value="power" {% if 'power' in graph_types %} selected {% endif%}>Power</option>
@@ -12,7 +12,7 @@
</div> </div>
</div> </div>
<script> <script>
te.Select.getOrCreateInstance(document.querySelector("#multiSelection")).setValue({{ graph_types| safe }}); te.Select.getOrCreateInstance(document.querySelector("#multiSelection-{{ workout.id }}")).setValue({{ graph_types| safe }});
</script> </script>
{% for graph_type in graph_types %} {% for graph_type in graph_types %}

View File

@@ -19,15 +19,7 @@
</button> </button>
</h2> </h2>
<div class="!visible collapse {% if loop.index != 1 %}hidden{% endif %}"> <div class="!visible collapse {% if loop.index != 1 %}hidden{% endif %}">
<!-- <div id="workout_view-{{ w.id }}">
<img src="{{ url_for('workout', user_id=w.user_id, workout_id=w.id, graph_type='cadence') }}" loading="lazy"
alt="No image" class="mx-auto">
<img src="{{ url_for('workout', user_id=w.user_id, workout_id=w.id, graph_type='speed') }}" loading="lazy"
alt="No image" class="mx-auto">
<img src="{{ url_for('workout', user_id=w.user_id, workout_id=w.id, graph_type='power') }}" loading="lazy"
alt="No image" class="mx-auto">
-->
<div id="workout_view">
{% with workout=w, graph_types=['speed'] %} {% with workout=w, graph_types=['speed'] %}
{% include 'workout_view.html' %} {% include 'workout_view.html' %}
{% endwith %} {% endwith %}