Private
Public Access
1
0

bike erg import from C2 log

This commit is contained in:
Sander Roosendaal
2018-08-29 09:46:46 +02:00
parent 10e989d32d
commit cadc5d5e0d
4 changed files with 19 additions and 7 deletions

View File

@@ -56,7 +56,8 @@ def c2_open(user):
return thetoken
def add_stroke_data(user,c2id,workoutid,startdatetime,csvfilename):
def add_stroke_data(user,c2id,workoutid,startdatetime,csvfilename,
workouttype='rower'):
r = Rower.objects.get(user=user)
if (r.c2token == '') or (r.c2token is None):
return custom_exception_handler(401,s)
@@ -73,7 +74,7 @@ def add_stroke_data(user,c2id,workoutid,startdatetime,csvfilename):
c2id,
workoutid,
starttimeunix,
csvfilename)
csvfilename,workouttype=workouttype)
return 1
@@ -164,7 +165,8 @@ def create_async_workout(alldata,user,c2id):
# Check if workout has stroke data, and get the stroke data
result = add_stroke_data(user,c2id,w.id,startdatetime,csvfilename)
result = add_stroke_data(user,c2id,w.id,startdatetime,csvfilename,
workouttype = w.workouttype)
return w.id
@@ -830,6 +832,8 @@ def add_workout_from_data(user,importid,data,strokedata,
pace = pace.replace(0,300)
velo = 500./pace
if workouttype == 'bike':
velo = 1000./pace
power = 2.8*velo**3