Private
Public Access
1
0

Merge tag 'v8.58' into develop

bug fix
This commit is contained in:
Sander Roosendaal
2018-11-27 10:55:25 +01:00
3 changed files with 29 additions and 11 deletions

View File

@@ -744,16 +744,27 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
duplicate=False, duplicate=False,
title='Manual entry',notes='',weightcategory='hwt'): title='Manual entry',notes='',weightcategory='hwt'):
if duration is not None:
totalseconds = duration.hour*3600.
totalseconds += duration.minute*60.
totalseconds += duration.second
totalseconds += duration.microsecond/1.e6
else:
totalseconds = 60.
if distance is None:
nr_strokes = int(distance/10.) distance = 0
try:
nr_strokes = int(distance/10.)
except TypeError:
nr_strokes = int(20.*totalseconds)
if nr_strokes == 0:
nr_strokes = 100
unixstarttime = arrow.get(startdatetime).timestamp unixstarttime = arrow.get(startdatetime).timestamp
totalseconds = duration.hour*3600.
totalseconds += duration.minute*60.
totalseconds += duration.second
totalseconds += duration.microsecond/1.e6
if not avgspm: if not avgspm:
try: try:
@@ -773,7 +784,10 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
unixtime = unixstarttime + elapsed unixtime = unixstarttime + elapsed
pace = 500.*totalseconds/distance try:
pace = 500.*totalseconds/distance
except ZeroDivisionError:
pace = 240.
if workouttype in ['rower','slides','dynamic']: if workouttype in ['rower','slides','dynamic']:
try: try:

View File

@@ -175,13 +175,14 @@ def create_async_workout(alldata,user,stravaid,debug=False):
except: except:
workouttype = 'other' workouttype = 'other'
if workouttype not in [x[0] for x in Workout.workouttypes]:
workouttype = 'other'
if workouttype.lower() == 'rowing': if workouttype.lower() == 'rowing':
workouttype = 'rower' workouttype = 'rower'
if 'summary_polyline' in data['map']: if 'summary_polyline' in data['map']:
workouttype = 'water' workouttype = 'water'
if workouttype not in [x[0] for x in Workout.workouttypes]:
workouttype = 'other'
try: try:
comments = data['comments'] comments = data['comments']

View File

@@ -16550,8 +16550,11 @@ def rower_create_trainingplan(request,userid=0):
startdate = form.cleaned_data['startdate'] startdate = form.cleaned_data['startdate']
enddate = form.cleaned_data['enddate'] enddate = form.cleaned_data['enddate']
athletes = form.cleaned_data['rowers'] try:
athletes = form.cleaned_data['rowers']
except KeyError:
athletes = [therower]
p = TrainingPlan( p = TrainingPlan(
name=name, name=name,
target=target, target=target,