Add database connection to global context so repeat queries dont recreate connections(Need to check if this actually improves speed) also added in logic so if add workout is triggered when there is already a workout on that day without any topsets it will instead load that

This commit is contained in:
Peter Stockings
2023-08-06 13:34:33 +10:00
parent 8e26cbf281
commit 5ccb1f1905
2 changed files with 40 additions and 10 deletions

5
app.py
View File

@@ -384,6 +384,11 @@ def get_workout_note(person_id, workout_id):
return render_template('partials/workout_note.html', person_id=person_id, workout_id=workout_id, note=workout['Note'])
@app.teardown_appcontext
def closeConnection(exception):
db.close_connection()
@app.template_filter('list_to_string')
def list_to_string(list):
return [str(i) for i in list]