diff --git a/app.py b/app.py index 9696d55..b9f4948 100644 --- a/app.py +++ b/app.py @@ -316,8 +316,9 @@ def render_users_and_workouts(): # Calculate the workout counts and duration for the current week workout_counts_by_week.append(len(weekly_workouts)) - duration_by_week.append( - int(sum([int(w['duration_minutes']) for w in weekly_workouts]))/len(weekly_workouts)) + if weekly_workouts: + duration_by_week.append( + int(sum([int(w['duration_minutes']) for w in weekly_workouts]))/len(weekly_workouts)) workout_counts_sparkline = sparklines.sparklines( workout_counts_by_week)