Add editable notes to workouts

This commit is contained in:
Peter Stockings
2023-07-12 19:35:55 +10:00
parent 19c586c5b2
commit c457002d1e
5 changed files with 203 additions and 129 deletions

22
app.py
View File

@@ -364,6 +364,28 @@ def delete_tag(tag_id):
return redirect(url_for('dashboard') + tag_filter)
@ app.route("/person/<int:person_id>/workout/<int:workout_id>/note/edit", methods=['GET'])
@ validate_workout
def get_workout_note_edit_form(person_id, workout_id):
workout = db.get_workout(person_id, workout_id)
return render_template('partials/workout_note.html', person_id=person_id, workout_id=workout_id, note=workout['Note'], is_edit=True)
@ app.route("/person/<int:person_id>/workout/<int:workout_id>/note", methods=['PUT'])
@ validate_workout
def update_workout_note(person_id, workout_id):
note = request.form.get('note')
db.update_workout_note_for_person(person_id, workout_id, note)
return render_template('partials/workout_note.html', person_id=person_id, workout_id=workout_id, note=note)
@ app.route("/person/<int:person_id>/workout/<int:workout_id>/note", methods=['GET'])
@ validate_workout
def get_workout_note(person_id, workout_id):
workout = db.get_workout(person_id, workout_id)
return render_template('partials/workout_note.html', person_id=person_id, workout_id=workout_id, note=workout['Note'])
@ app.context_processor
def my_utility_processor():