API - fix total ascent when user has workous without gpx

This commit is contained in:
Sam
2022-07-19 16:33:05 +02:00
parent 0cb4a26cf2
commit ee67b74d06
2 changed files with 43 additions and 2 deletions

View File

@ -127,7 +127,7 @@ class User(BaseModel):
raise UserNotFoundException()
sports = []
total = (0, '0:00:00')
total = (0, '0:00:00', 0)
if self.workouts_count > 0: # type: ignore
sports = (
db.session.query(Workout.sport_id)
@ -164,9 +164,9 @@ class User(BaseModel):
'sports_list': [
sport for sportslist in sports for sport in sportslist
],
'total_ascent': float(total[2]) if total[2] else 0.0,
'total_distance': float(total[0]),
'total_duration': str(total[1]),
'total_ascent': float(total[2]),
'username': self.username,
}
if role == UserRole.AUTH_USER: