Swtich from person list to new overview page
This commit is contained in:
23
utils.py
23
utils.py
@@ -127,29 +127,6 @@ def convert_str_to_date(date_str, format='%Y-%m-%d'):
|
||||
return None
|
||||
|
||||
|
||||
def get_earliest_and_latest_workout_date(person):
|
||||
workouts = person.get('Workouts', [])
|
||||
if workouts:
|
||||
# Initialize earliest and latest dates with the first workout's start date
|
||||
earliest_date = latest_date = workouts[0]['StartDate']
|
||||
for workout in workouts[1:]:
|
||||
date = workout['StartDate']
|
||||
if date < earliest_date:
|
||||
earliest_date = date
|
||||
if date > latest_date:
|
||||
latest_date = date
|
||||
return (earliest_date, latest_date)
|
||||
|
||||
# Return the current date for both if no workouts are present
|
||||
current_date = datetime.now().date()
|
||||
return (current_date, current_date)
|
||||
|
||||
|
||||
def filter_workout_topsets(workout, selected_exercise_ids):
|
||||
workout['TopSets'] = [topset for topset in workout['TopSets']
|
||||
if topset['ExerciseId'] in selected_exercise_ids]
|
||||
return workout
|
||||
|
||||
|
||||
def flatten_list(list_of_lists):
|
||||
return [item for sublist in list_of_lists for item in sublist]
|
||||
|
||||
Reference in New Issue
Block a user