bug fix
This commit is contained in:
@@ -111,6 +111,7 @@ def filter_df(datadf,fieldname,value,largerthan=True):
|
||||
except KeyError:
|
||||
return datadf
|
||||
|
||||
|
||||
if largerthan:
|
||||
mask = datadf[fieldname] < value
|
||||
else:
|
||||
@@ -144,6 +145,7 @@ def clean_df_stats(datadf,workstrokesonly=True,ignorehr=True,
|
||||
datadf=datadf.clip(lower=0)
|
||||
datadf.replace(to_replace=0,value=np.nan,inplace=True)
|
||||
|
||||
|
||||
# return from positive domain to negative
|
||||
try:
|
||||
datadf['catch'] = -datadf['catch']
|
||||
@@ -1207,8 +1209,6 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
||||
distance = rowdatadf.ix[:,'cum_dist']
|
||||
|
||||
|
||||
|
||||
|
||||
data = DataFrame(
|
||||
dict(
|
||||
time = t*1e3,
|
||||
@@ -1231,7 +1231,6 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if bands:
|
||||
# HR bands
|
||||
data['hr_ut2'] = rowdatadf.ix[:,'hr_ut2']
|
||||
@@ -1272,10 +1271,15 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
||||
except KeyError:
|
||||
peakforceangle = 0*power
|
||||
|
||||
try:
|
||||
driveenergy = rowdatadf.ix[:,'driveenergy']
|
||||
except KeyError:
|
||||
driveenergy = 0*power
|
||||
|
||||
if data['driveenergy'].mean() == 0:
|
||||
try:
|
||||
driveenergy = rowdatadf.ix[:,'driveenergy']
|
||||
except KeyError:
|
||||
driveenergy = 0*power
|
||||
else:
|
||||
driveenergy = data['driveenergy']
|
||||
|
||||
|
||||
arclength = (inboard-0.05)*(np.radians(finish)-np.radians(catch))
|
||||
if arclength.mean()>0:
|
||||
|
||||
@@ -387,7 +387,11 @@ def sendmail(request):
|
||||
def add_workout_from_strokedata(user,importid,data,strokedata,
|
||||
source='c2',splitdata=None,
|
||||
workoutsource='concept2'):
|
||||
workouttype = data['type']
|
||||
try:
|
||||
workouttype = data['type']
|
||||
except KeyError:
|
||||
workouttype = 'rower'
|
||||
|
||||
if workouttype not in [x[0] for x in Workout.workouttypes]:
|
||||
workouttype = 'water'
|
||||
try:
|
||||
@@ -6178,17 +6182,23 @@ def workout_getstravaworkout_all(request):
|
||||
strokedata = res[1]
|
||||
data = res[0]
|
||||
|
||||
id,message = add_workout_from_strokedata(request.user,stravaid,data,strokedata,
|
||||
source='strava',
|
||||
workoutsource='strava')
|
||||
if data:
|
||||
id,message = add_workout_from_strokedata(
|
||||
request.user,stravaid,data,strokedata,
|
||||
source='strava',
|
||||
workoutsource='strava')
|
||||
|
||||
if id==0:
|
||||
messages.error(request,message)
|
||||
if id==0:
|
||||
messages.error(request,message)
|
||||
|
||||
else:
|
||||
messages.info(request,"imported Strava workout "+str(stravaid))
|
||||
w = Workout.objects.get(id=id)
|
||||
w.uploadedtostrava=stravaid
|
||||
w.save()
|
||||
|
||||
else:
|
||||
w = Workout.objects.get(id=id)
|
||||
w.uploadedtostrava=stravaid
|
||||
w.save()
|
||||
messages.error(request,"Couldn't import Strava workout "+str(stravaid))
|
||||
|
||||
url = reverse(workouts_view)
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
Reference in New Issue
Block a user