bug fix c2importall
This commit is contained in:
@@ -958,7 +958,11 @@ def add_workout_from_strokedata(user,importid,data,strokedata,
|
|||||||
|
|
||||||
dist2 = 0.1*strokedata.ix[:,'d']
|
dist2 = 0.1*strokedata.ix[:,'d']
|
||||||
|
|
||||||
|
try:
|
||||||
spm = strokedata.ix[:,'spm']
|
spm = strokedata.ix[:,'spm']
|
||||||
|
except KeyError:
|
||||||
|
spm = 0*dist2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
hr = strokedata.ix[:,'hr']
|
hr = strokedata.ix[:,'hr']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -8961,6 +8965,7 @@ def workout_getc2workout_all(request,page=1,message=""):
|
|||||||
if res2.status_code == 200:
|
if res2.status_code == 200:
|
||||||
strokedata = pd.DataFrame.from_dict(res2.json()['data'])
|
strokedata = pd.DataFrame.from_dict(res2.json()['data'])
|
||||||
# create the workout
|
# create the workout
|
||||||
|
try:
|
||||||
id,message = add_workout_from_strokedata(
|
id,message = add_workout_from_strokedata(
|
||||||
request.user,c2id,data,strokedata,
|
request.user,c2id,data,strokedata,
|
||||||
source='c2')
|
source='c2')
|
||||||
@@ -8969,6 +8974,8 @@ def workout_getc2workout_all(request,page=1,message=""):
|
|||||||
w.save()
|
w.save()
|
||||||
if message:
|
if message:
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
url = reverse(workouts_view)
|
url = reverse(workouts_view)
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|||||||
Reference in New Issue
Block a user