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