Fix error thrown when viewing profile of a person with a single workout with a single topset
This commit is contained in:
9
utils.py
9
utils.py
@@ -111,10 +111,11 @@ def get_stats_from_topsets(topsets):
|
|||||||
date.today() - last_workout_date).days})
|
date.today() - last_workout_date).days})
|
||||||
|
|
||||||
training_duration = last_workout_date - first_workout_date
|
training_duration = last_workout_date - first_workout_date
|
||||||
average_workouts_per_week = round(
|
if training_duration > timedelta(days=0):
|
||||||
workout_count / (training_duration.days / 7), 2)
|
average_workouts_per_week = round(
|
||||||
stats.append({"Text": "Average Workouts Per Week",
|
workout_count / (training_duration.days / 7), 2)
|
||||||
"Value": average_workouts_per_week})
|
stats.append({"Text": "Average Workouts Per Week",
|
||||||
|
"Value": average_workouts_per_week})
|
||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user