Display exercise history when name is clicked on workout overview(modal) using person list filters (Should look into changing workout overview modal to a seperate page so you can access it via a url)

This commit is contained in:
Peter Stockings
2023-08-06 22:51:24 +10:00
parent fdbb60b490
commit 465bb74b87
4 changed files with 9 additions and 6 deletions

4
app.py
View File

@@ -214,7 +214,7 @@ def get_workout_start_date(person_id, workout_id):
@ validate_topset @ validate_topset
def get_topset(person_id, workout_id, topset_id): def get_topset(person_id, workout_id, topset_id):
topset = db.get_topset(person_id, workout_id, topset_id) topset = db.get_topset(person_id, workout_id, topset_id)
return render_template('partials/topset.html', person_id=person_id, workout_id=workout_id, topset_id=topset_id, exercise_name=topset['ExerciseName'], repetitions=topset['Repetitions'], weight=topset['Weight']) return render_template('partials/topset.html', person_id=person_id, workout_id=workout_id, topset_id=topset_id, exercise_id=topset['ExerciseId'], exercise_name=topset['ExerciseName'], repetitions=topset['Repetitions'], weight=topset['Weight'])
@ app.route("/person/<int:person_id>/workout/<int:workout_id>/topset/<int:topset_id>/edit_form", methods=['GET']) @ app.route("/person/<int:person_id>/workout/<int:workout_id>/topset/<int:topset_id>/edit_form", methods=['GET'])
@@ -236,7 +236,7 @@ def create_topset(person_id, workout_id):
workout_id, exercise_id, repetitions, weight) workout_id, exercise_id, repetitions, weight)
exercise = db.get_exercise(exercise_id) exercise = db.get_exercise(exercise_id)
return render_template('partials/topset.html', person_id=person_id, workout_id=workout_id, topset_id=new_topset_id, exercise_name=exercise['Name'], repetitions=repetitions, weight=weight), 200, {"HX-Trigger": "topsetAdded"} return render_template('partials/topset.html', person_id=person_id, workout_id=workout_id, topset_id=new_topset_id, exercise_id=exercise_id, exercise_name=exercise['Name'], repetitions=repetitions, weight=weight), 200, {"HX-Trigger": "topsetAdded"}
@ app.route("/person/<int:person_id>/workout/<int:workout_id>/topset/<int:topset_id>", methods=['PUT']) @ app.route("/person/<int:person_id>/workout/<int:workout_id>/topset/<int:topset_id>", methods=['PUT'])

View File

@@ -1,7 +1,9 @@
<tr> <tr>
<td class="p-0 sm:p-4 text-sm font-semibold text-gray-900 break-normal"> <td class="p-0 sm:p-4 text-sm font-semibold text-gray-900 break-normal">
{% if is_edit|default(false, true) == false %} {% if is_edit|default(false, true) == false %}
{{ exercise_name }} <span class="cursor-pointer" hx-get="{{ url_for('goto_tag') }}"
hx-vals='{"filter": "?exercise_id={{ exercise_id }}", "person_id" : "{{ person_id }}" }'
hx-target="#container" hx-push-url="true" _='on click trigger closeModal'>{{ exercise_name }}</span>
{% else %} {% else %}
<div class="w-full"> <div class="w-full">
<select id="topset-exercise-select-{{ topset_id }}" data-te-select-init data-te-select-filter="true" <select id="topset-exercise-select-{{ topset_id }}" data-te-select-init data-te-select-filter="true"

View File

@@ -74,7 +74,8 @@
{% for t in workout['TopSets'] %} {% for t in workout['TopSets'] %}
{{ render_partial('partials/topset.html', person_id=workout['PersonId'], {{ render_partial('partials/topset.html', person_id=workout['PersonId'],
workout_id=workout['WorkoutId'], workout_id=workout['WorkoutId'],
topset_id=t['TopSetId'], exercise_name=t['ExerciseName'], repetitions=t['Repetitions'], topset_id=t['TopSetId'], exercise_id=t['ExerciseId'] ,exercise_name=t['ExerciseName'],
repetitions=t['Repetitions'],
weight=t['Weight']) }} weight=t['Weight']) }}
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@@ -3,7 +3,7 @@
{{ render_partial('partials/workout_tags_list.html', workout_tags=workout_tags) {{ render_partial('partials/workout_tags_list.html', workout_tags=workout_tags)
}} }}
</div> </div>
<span id="tag-form-show-w-{{ workout_id }}" class="" _="on click <span id="tag-form-show-w-{{ workout_id }}" class="cursor-pointer" _="on click
toggle .hidden on #tag-form-w-{{ workout_id }} toggle .hidden on #tag-form-w-{{ workout_id }}
then toggle .hidden on #tag-form-hide-w-{{ workout_id }} then toggle .hidden on #tag-form-hide-w-{{ workout_id }}
then toggle .hidden on me"> then toggle .hidden on me">
@@ -15,7 +15,7 @@
<span id="tag-form-hide-w-{{ workout_id }}" _="on click <span id="tag-form-hide-w-{{ workout_id }}" _="on click
toggle .hidden on #tag-form-w-{{ workout_id }} toggle .hidden on #tag-form-w-{{ workout_id }}
then toggle .hidden on #tag-form-show-w-{{ workout_id }} then toggle .hidden on #tag-form-show-w-{{ workout_id }}
then toggle .hidden on me" class="hidden"> then toggle .hidden on me" class="cursor-pointer hidden">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
class="w-6 h-6"> class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 12h-15" /> <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 12h-15" />