Show list of workouts in descending order

This commit is contained in:
Peter Stockings
2022-11-19 20:36:29 +11:00
parent ab08c19e6a
commit 32389738ff

View File

@@ -4,12 +4,12 @@ import json
def get_workouts(topsets):
# Get all unique workout_ids (No duplicates)
workout_ids = set([t['WorkoutId']
for t in topsets if t['WorkoutId'] is not None])
workout_ids = list(set([t['WorkoutId']
for t in topsets if t['WorkoutId'] is not None]))
# Group topsets into workouts
workouts = []
for workout_id in workout_ids:
for workout_id in reversed(workout_ids):
topsets_in_workout = [
t for t in topsets if t['WorkoutId'] == workout_id]
workouts.append({