Changeset e52a502 in OpenWorkouts-current for ow/views/workout.py


Ignore:
Timestamp:
Apr 19, 2019, 5:03:49 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current
Children:
42baca4
Parents:
39dc0a6
Message:

(#73) Fixed broken "add workout manually" when provided with a distance value
with decimals.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/views/workout.py

    r39dc0a6 re52a502  
    4141        # "bind" to the object, we do calculate both the full duration in
    4242        # seconds and the full datetime "start" and we save that
     43        #
     44        # exclude also the distance field, we have to convert to decimal
     45        # before adding it
    4346        excluded = ['duration_hours', 'duration_minutes', 'duration_seconds',
    44                     'start_date', 'start_time']
     47                    'start_date', 'start_time', 'distance']
    4548        workout = form.bind(Workout(), exclude=excluded)
    4649        duration = timedelta(hours=form.data['duration_hours'],
     
    6063                workout.title += ' ' + workout.sport
    6164            workout.title += ' ' + _('workout')
     65        workout.distance = Decimal(form.data['distance'])
    6266        context.add_workout(workout)
    6367        return HTTPFound(location=request.resource_url(workout))
Note: See TracChangeset for help on using the changeset viewer.