WIP: Add option to toggle graphs (havent yet added axis filter)
This commit is contained in:
11
app.py
11
app.py
@@ -83,6 +83,8 @@ def get_person(person_id):
|
||||
max_date = convert_str_to_date(request.args.get(
|
||||
'max_date'), '%Y-%m-%d') or max_date
|
||||
|
||||
graph_axis = request.args.getlist('graph_axis') or []
|
||||
|
||||
selected_exercise_ids = [int(i)
|
||||
for i in request.args.getlist('exercise_id')]
|
||||
if not selected_exercise_ids and htmx.trigger_name != 'exercise_id':
|
||||
@@ -114,13 +116,16 @@ def get_person(person_id):
|
||||
if topsets_for_exercise:
|
||||
repitions = [t['Repetitions'] for t in topsets_for_exercise]
|
||||
weights = [t['Weight'] for t in topsets_for_exercise]
|
||||
estimated_one_rep_max = [t['Estimated1RM']
|
||||
for t in topsets_for_exercise]
|
||||
start_dates = [t['StartDate'].strftime(
|
||||
"%Y-%m-%d") for t in topsets_for_exercise]
|
||||
exercise_view_model = {
|
||||
'ExerciseId': exercise_id,
|
||||
'ExerciseName': topsets_for_exercise[0]['ExerciseName'],
|
||||
'Repititions': repitions[::-1],
|
||||
'Repetitions': repitions[::-1],
|
||||
'Weights': weights[::-1],
|
||||
'Estimated1RM': estimated_one_rep_max[::-1],
|
||||
'StartDates': start_dates[::-1]
|
||||
}
|
||||
exercise_graph_view_models.append(exercise_view_model)
|
||||
@@ -128,9 +133,9 @@ def get_person(person_id):
|
||||
|
||||
if htmx:
|
||||
return render_template('partials/page/person.html',
|
||||
person=person, selected_exercise_ids=active_exercise_ids, max_date=max_date, min_date=min_date, tags=tags), 200, {"HX-Trigger": "updatedPeople"}
|
||||
person=person, selected_exercise_ids=active_exercise_ids, max_date=max_date, min_date=min_date, tags=tags, graph_axis=graph_axis), 200, {"HX-Trigger": "updatedPeople"}
|
||||
|
||||
return render_template('person.html', person=person, selected_exercise_ids=active_exercise_ids, max_date=max_date, min_date=min_date, tags=tags), 200, {"HX-Trigger": "updatedPeople"}
|
||||
return render_template('person.html', person=person, selected_exercise_ids=active_exercise_ids, max_date=max_date, min_date=min_date, tags=tags, graph_axis=graph_axis), 200, {"HX-Trigger": "updatedPeople"}
|
||||
|
||||
|
||||
@ app.route("/person/<int:person_id>/calendar")
|
||||
|
||||
Reference in New Issue
Block a user