From 73c1e115bb2cc0c00634fd3802fa078a2f21c0fb Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Sat, 18 May 2024 18:27:09 +1000 Subject: [PATCH] Fix bug where left join on person and workouts would return a row even when there wasnt an exercise and therefore crashing on person list view --- utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/utils.py b/utils.py index ce6699a..b9c2432 100644 --- a/utils.py +++ b/utils.py @@ -71,14 +71,15 @@ def get_topsets_for_person(person_topsets): person_id = sorted_topsets[0]['PersonId'] exercise_name = sorted_topsets[0]['ExerciseName'] - exercise_progress = get_exercise_graph_model(exercise_name, estimated_1rm, repetitions, weight, start_dates, messages, epoch, person_id, exercise_id) + if exercise_name and estimated_1rm and repetitions and weight and start_dates and messages: + exercise_progress = get_exercise_graph_model(exercise_name, estimated_1rm, repetitions, weight, start_dates, messages, epoch, person_id, exercise_id) - exercises_topsets.append({ - 'ExerciseId': exercise_id, - 'ExerciseName': exercise_name, - 'Topsets': sorted_topsets, - 'ExerciseProgressGraph': exercise_progress - }) + exercises_topsets.append({ + 'ExerciseId': exercise_id, + 'ExerciseName': exercise_name, + 'Topsets': sorted_topsets, + 'ExerciseProgressGraph': exercise_progress + }) return exercises_topsets