Private
Public Access
1
0

bug fix c2importall

This commit is contained in:
Sander Roosendaal
2017-12-20 16:14:46 +01:00
parent e5a1179125
commit afdee332da

View File

@@ -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']
spm = strokedata.ix[:,'spm'] try:
spm = strokedata.ix[:,'spm']
except KeyError:
spm = 0*dist2
try: try:
hr = strokedata.ix[:,'hr'] hr = strokedata.ix[:,'hr']
except KeyError: except KeyError:
@@ -8961,14 +8965,17 @@ 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
id,message = add_workout_from_strokedata( try:
request.user,c2id,data,strokedata, id,message = add_workout_from_strokedata(
source='c2') request.user,c2id,data,strokedata,
w = Workout.objects.get(id=id) source='c2')
w.uploadedtoc2=c2id w = Workout.objects.get(id=id)
w.save() w.uploadedtoc2=c2id
if message: w.save()
messages.error(request,message) if message:
messages.error(request,message)
except KeyError:
pass
url = reverse(workouts_view) url = reverse(workouts_view)
return HttpResponseRedirect(url) return HttpResponseRedirect(url)