fixing some C2 bike erg related stuff
This commit is contained in:
@@ -268,7 +268,8 @@ def c2wc(weightclass):
|
||||
# Concept2 logbook sends over split data for each interval
|
||||
# We use it here to generate a custom summary
|
||||
# Some users complained about small differences
|
||||
def summaryfromsplitdata(splitdata,data,filename,sep='|'):
|
||||
def summaryfromsplitdata(splitdata,data,filename,sep='|',workouttype='rower'):
|
||||
workouttype = workouttype.lower()
|
||||
|
||||
totaldist = data['distance']
|
||||
totaltime = data['time']/10.
|
||||
@@ -305,6 +306,11 @@ def summaryfromsplitdata(splitdata,data,filename,sep='|'):
|
||||
|
||||
velo = totaldist/totaltime
|
||||
avgpower = 2.8*velo**(3.0)
|
||||
if workouttype in ['bike','bikeerg']:
|
||||
velo = velo/2.
|
||||
avgpower = 2.8*velo**(3.0)
|
||||
velo = velo*2
|
||||
|
||||
|
||||
try:
|
||||
restvelo = restdistance/resttime
|
||||
@@ -312,6 +318,10 @@ def summaryfromsplitdata(splitdata,data,filename,sep='|'):
|
||||
restvelo = 0
|
||||
|
||||
restpower = 2.8*restvelo**(3.0)
|
||||
if workouttype in ['bike','bikeerg']:
|
||||
restvelo = restvelo/2.
|
||||
restpower = 2.8*restvelo**(3.0)
|
||||
restvelo = restvelo*2
|
||||
|
||||
try:
|
||||
avgdps = totaldist/data['stroke_count']
|
||||
@@ -398,6 +408,8 @@ def summaryfromsplitdata(splitdata,data,filename,sep='|'):
|
||||
if itime != 0:
|
||||
ivelo = idist/itime
|
||||
ipower = 2.8*ivelo**(3.0)
|
||||
if workouttype in ['bike','bikeerg']:
|
||||
ipower = 2.8*(ivelo/2.)**(3.0)
|
||||
else:
|
||||
ivelo = 0
|
||||
ipower = 0
|
||||
@@ -961,6 +973,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
thetimezone = 'UTC'
|
||||
|
||||
r = Rower.objects.get(user=user)
|
||||
|
||||
try:
|
||||
rowdatetime = iso8601.parse_date(data['date_utc'])
|
||||
except KeyError:
|
||||
@@ -969,6 +982,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
rowdatetime = iso8601.parse_date(data['date'])
|
||||
|
||||
|
||||
|
||||
try:
|
||||
c2intervaltype = data['workout_type']
|
||||
|
||||
@@ -1090,10 +1104,18 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
dosummary=True,dosmooth=False,
|
||||
)
|
||||
|
||||
|
||||
w = Workout.objects.get(id=id)
|
||||
|
||||
|
||||
w.duration = dataprep.totaltime_sec_to_string(totaltime)
|
||||
w.distance = totaldist
|
||||
w.startdatetime = rowdatetime
|
||||
w.starttime = rowdatetime.time()
|
||||
w.date = rowdatetime.date()
|
||||
|
||||
w.save()
|
||||
|
||||
|
||||
|
||||
return id,message
|
||||
|
||||
Reference in New Issue
Block a user