Changeset 6edc367 in OpenWorkouts-current for ow/views


Ignore:
Timestamp:
Feb 8, 2019, 5:20:26 PM (5 years ago)
Author:
Segundo Fdez <segun.2@…>
Branches:
current, feature/docs, master
Children:
4226ce0
Parents:
2a71053 (diff), 55470f9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'feature/ui' of ssh://openworkouts/home/repos/git/OpenWorkouts-current into feature/ui

Location:
ow/views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ow/views/user.py

    r2a71053 r6edc367  
    178178
    179179    for workout in workouts:
    180         totals['distance'] += getattr(workout, 'distance', Decimal(0))
    181         totals['time'] += getattr(workout, 'duration', timedelta(0))
    182         totals['elevation'] += getattr(workout, 'uphill', Decimal(0))
     180        totals['distance'] += (
     181            getattr(workout, 'distance', Decimal(0)) or Decimal(0))
     182        totals['time'] += (
     183            getattr(workout, 'duration', timedelta(0)) or timedelta(0))
     184        totals['elevation'] += (
     185            getattr(workout, 'uphill', Decimal(0)) or Decimal(0))
    183186
    184187    return {
  • ow/views/workout.py

    r2a71053 r6edc367  
    128128        return HTTPFound(location=request.resource_url(context))
    129129
     130    # round some values before rendering
     131    if form.data['distance']:
     132        form.data['distance'] = round(form.data['distance'], 2)
     133
    130134    return {
    131135        'form': FormRenderer(form)
Note: See TracChangeset for help on using the changeset viewer.