Add view to list workout notes for a person

This commit is contained in:
Peter Stockings
2024-03-09 18:50:44 +11:00
parent e3de9f886b
commit dae4fcbf44
6 changed files with 165 additions and 5 deletions

10
app.py
View File

@@ -125,6 +125,8 @@ def get_calendar(person_id):
if selected_view == 'all':
return redirect(url_for('get_person', person_id=person_id))
elif selected_view == 'notes':
return redirect(url_for('get_person_notes', person_id=person_id))
# selected_view = month | year | all
date_info = get_date_info(selected_date, selected_view)
@@ -133,6 +135,14 @@ def get_calendar(person_id):
return render_block(app.jinja_env, 'calendar.html', 'content', person=person, selected_date=selected_date, selected_view=selected_view, **date_info, datetime=datetime, timedelta=timedelta, relativedelta=relativedelta, first_and_last_visible_days_in_month=first_and_last_visible_days_in_month)
return render_template('calendar.html', person=person, selected_date=selected_date, selected_view=selected_view, **date_info, datetime=datetime, timedelta=timedelta, relativedelta=relativedelta, first_and_last_visible_days_in_month=first_and_last_visible_days_in_month)
@ app.route("/person/<int:person_id>/notes", methods=['GET'])
@ validate_person
def get_person_notes(person_id):
(person_name, workout_notes) = db.get_workout_notes_for_person(person_id)
if htmx:
return render_block(app.jinja_env, 'notes.html', 'content', person_id=person_id, person_name=person_name, workout_notes=workout_notes)
return render_template('notes.html', person_id=person_id, person_name=person_name, workout_notes=workout_notes)
@ app.route("/person/<int:person_id>/workout/<int:workout_id>/modal", methods=['GET'])
@ validate_workout