Changeset 04c882d in OpenWorkouts-current for ow/models/user.py
- Timestamp:
- Mar 6, 2019, 11:25:01 AM (5 years ago)
- Branches:
- current
- Children:
- 8d726ec
- Parents:
- aa6dcaf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/models/user.py
raa6dcaf r04c882d 405 405 'distance': Decimal(0), 406 406 'elevation': Decimal(0), 407 'max_time': timedelta(0), 408 'max_time_wid': None, 409 'max_distance': Decimal(0), 410 'max_distance_wid': None, 411 'max_elevation': Decimal(0), 412 'max_elevation_wid': None 407 413 } 414 408 415 if self.activity_sports: 409 416 sport = sport or self.favorite_sport … … 411 418 if workout.sport == sport: 412 419 if year is None or workout.start.year == year: 420 wid = str(workout.workout_id) 421 time = workout.duration or timedelta(0) 422 distance = workout.distance or Decimal(0) 423 elevation = workout.uphill or Decimal(0) 413 424 totals['workouts'] += 1 414 totals['time'] += workout.duration or timedelta(0) 415 totals['distance'] += workout.distance or Decimal(0) 416 totals['elevation'] += workout.uphill or Decimal(0) 425 totals['time'] += time 426 totals['distance'] += distance 427 totals['elevation'] += elevation 428 if time > totals['max_time']: 429 totals['max_time'] = time 430 totals['max_time_wid'] = wid 431 if distance > totals['max_distance']: 432 totals['max_distance'] = distance 433 totals['max_distance_wid'] = wid 434 if elevation > totals['max_elevation']: 435 totals['max_elevation'] = elevation 436 totals['max_elevation_wid'] = wid 437 417 438 return totals
Note: See TracChangeset
for help on using the changeset viewer.