Manual Entry working
This commit is contained in:
@@ -1242,7 +1242,7 @@ def fetchcp(rower,theworkouts,table='cpdata'):
|
|||||||
def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
|
def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
|
||||||
avghr=None,avgpwr=None,avgspm=None,
|
avghr=None,avgpwr=None,avgspm=None,
|
||||||
rankingpiece = False,
|
rankingpiece = False,
|
||||||
duplicate=False,
|
duplicate=False,rpe=-1,
|
||||||
title='Manual entry',notes='',weightcategory='hwt',
|
title='Manual entry',notes='',weightcategory='hwt',
|
||||||
adaptiveclass='None'):
|
adaptiveclass='None'):
|
||||||
|
|
||||||
@@ -1351,6 +1351,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
workoutsource='unknown',
|
workoutsource='unknown',
|
||||||
notes='', totaldist=0, totaltime=0,
|
notes='', totaldist=0, totaltime=0,
|
||||||
rankingpiece=False,
|
rankingpiece=False,
|
||||||
|
rpe=-1,
|
||||||
duplicate=False,
|
duplicate=False,
|
||||||
summary='',
|
summary='',
|
||||||
makeprivate=False,
|
makeprivate=False,
|
||||||
@@ -1571,6 +1572,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
if title is not None and len(title)>140:
|
if title is not None and len(title)>140:
|
||||||
title = title[0:140]
|
title = title[0:140]
|
||||||
|
|
||||||
|
|
||||||
w = Workout(user=r, name=title, date=workoutdate,
|
w = Workout(user=r, name=title, date=workoutdate,
|
||||||
workouttype=workouttype,
|
workouttype=workouttype,
|
||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
@@ -1583,6 +1585,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
workoutsource=workoutsource,
|
workoutsource=workoutsource,
|
||||||
rankingpiece=rankingpiece,
|
rankingpiece=rankingpiece,
|
||||||
forceunit=forceunit,
|
forceunit=forceunit,
|
||||||
|
rpe=rpe,
|
||||||
csvfilename=f2, notes=notes, summary=summary,
|
csvfilename=f2, notes=notes, summary=summary,
|
||||||
maxhr=maxhr, averagehr=averagehr,
|
maxhr=maxhr, averagehr=averagehr,
|
||||||
startdatetime=workoutstartdatetime,
|
startdatetime=workoutstartdatetime,
|
||||||
|
|||||||
@@ -1655,24 +1655,25 @@ def getfatigues(
|
|||||||
ws = Workout.objects.filter(user=user.rower,date=date,duplicate=False)
|
ws = Workout.objects.filter(user=user.rower,date=date,duplicate=False)
|
||||||
weight = 0
|
weight = 0
|
||||||
for w in ws:
|
for w in ws:
|
||||||
|
if getattr(w,metricchoice) > 0:
|
||||||
weight += factor*getattr(w,metricchoice)
|
weight += factor*getattr(w,metricchoice)
|
||||||
if getattr(w,metricchoice) <= 0:
|
if getattr(w,metricchoice) <= 0:
|
||||||
if metricchoice == 'rscore' and w.hrtss > 0:
|
if metricchoice == 'rscore' and w.hrtss > 0:
|
||||||
weight+= factor*w.hrtss
|
weight+= factor*w.hrtss
|
||||||
else:
|
elif metricchoice == 'rscore' and w.hrtss <= 0:
|
||||||
trimp,hrtss = dataprep.workout_trimp(w)
|
trimp,hrtss = dataprep.workout_trimp(w)
|
||||||
rscore,normp = dataprep.workout_rscore(w)
|
rscore,normp = dataprep.workout_rscore(w)
|
||||||
if w.rpe and w.rpe > 0:
|
if w.rpe and w.rpe > 0:
|
||||||
dd = 3600*w.duration.hour+60*w.duration.minute+w.duration.second
|
dd = 3600*w.duration.hour+60*w.duration.minute+w.duration.second
|
||||||
dd = dd/3600
|
dd = dd/3600
|
||||||
weight += factor*rpetotss[w.rpe]*dd
|
weight += factor*rpetotss[w.rpe]*dd
|
||||||
if metricchoice == 'trimp' and w.trimp <= 0:
|
elif metricchoice == 'trimp' and w.trimp <= 0:
|
||||||
trimp,hrtss = dataprep.workout_trimp(w)
|
trimp,hrtss = dataprep.workout_trimp(w)
|
||||||
rscore,normp = dataprep.workout_rscore(w)
|
rscore,normp = dataprep.workout_rscore(w)
|
||||||
if w.rpe and w.rpe > 0:
|
if w.rpe and w.rpe > 0:
|
||||||
dd = 3600*w.duration.hour+60*w.duration.minute+w.duration.second
|
dd = 3600*w.duration.hour+60*w.duration.minute+w.duration.second
|
||||||
dd = dd/3600
|
dd = dd/3600
|
||||||
weight += factor*rpetotss[w.rpe]*dd
|
weight += 2*rpetotss[w.rpe]*dd
|
||||||
|
|
||||||
impulses.append(weight)
|
impulses.append(weight)
|
||||||
|
|
||||||
|
|||||||
@@ -636,6 +636,7 @@ def addmanual_view(request,raceid=0):
|
|||||||
id,message = dataprep.create_row_df(r,
|
id,message = dataprep.create_row_df(r,
|
||||||
distance,
|
distance,
|
||||||
duration,startdatetime,
|
duration,startdatetime,
|
||||||
|
rpe=rpe,
|
||||||
weightcategory=weightcategory,
|
weightcategory=weightcategory,
|
||||||
adaptiveclass=adaptiveclass,
|
adaptiveclass=adaptiveclass,
|
||||||
avghr=avghr,
|
avghr=avghr,
|
||||||
@@ -661,6 +662,7 @@ def addmanual_view(request,raceid=0):
|
|||||||
w.notes = notes
|
w.notes = notes
|
||||||
w.plannedsession = ps
|
w.plannedsession = ps
|
||||||
w.name = name
|
w.name = name
|
||||||
|
w.rpe = rpe
|
||||||
w.workouttype = workouttype
|
w.workouttype = workouttype
|
||||||
w.boattype = boattype
|
w.boattype = boattype
|
||||||
w.save()
|
w.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user