Show list of workouts in descending order
This commit is contained in:
6
utils.py
6
utils.py
@@ -4,12 +4,12 @@ import json
|
|||||||
|
|
||||||
def get_workouts(topsets):
|
def get_workouts(topsets):
|
||||||
# Get all unique workout_ids (No duplicates)
|
# Get all unique workout_ids (No duplicates)
|
||||||
workout_ids = set([t['WorkoutId']
|
workout_ids = list(set([t['WorkoutId']
|
||||||
for t in topsets if t['WorkoutId'] is not None])
|
for t in topsets if t['WorkoutId'] is not None]))
|
||||||
|
|
||||||
# Group topsets into workouts
|
# Group topsets into workouts
|
||||||
workouts = []
|
workouts = []
|
||||||
for workout_id in workout_ids:
|
for workout_id in reversed(workout_ids):
|
||||||
topsets_in_workout = [
|
topsets_in_workout = [
|
||||||
t for t in topsets if t['WorkoutId'] == workout_id]
|
t for t in topsets if t['WorkoutId'] == workout_id]
|
||||||
workouts.append({
|
workouts.append({
|
||||||
|
|||||||
Reference in New Issue
Block a user