From 5d8eedd591351aa29158d90646148847cdc43843 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Mon, 20 Mar 2023 22:02:15 +1100 Subject: [PATCH] Only display workouts in list view that contain selected exercises --- app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.py b/app.py index 54addd6..31ad0d5 100644 --- a/app.py +++ b/app.py @@ -69,6 +69,10 @@ def get_person(person_id): active_exercise_ids = get_exercise_ids_from_workouts(person['Workouts']) + # Filter out workouts that dont contain any of the selected exercises + person['Workouts'] = [workout for workout in person['Workouts'] if + workout['TopSets']] + filtered_exercises = filter( lambda e: e['ExerciseId'] in active_exercise_ids, person['Exercises']) person['FilteredExercises'] = list(filtered_exercises)