Private
Public Access
1
0

added kfit and kfatigue to profile page

This commit is contained in:
Sander Roosendaal
2020-12-02 11:56:40 +01:00
parent 83e086056f
commit fe96b619e1
5 changed files with 36 additions and 20 deletions

View File

@@ -1555,14 +1555,14 @@ def performancemanager_view(request,userid=0,mode='rower',
therower = getrequestrower(request,userid=userid)
theuser = therower.user
kfitness = 42
kfatigue = 7
kfitness = therower.kfit
kfatigue = therower.kfatigue
fitnesstest = 20
metricchoice = 'trimp'
modelchoice = 'tsb'
usefitscore = False
doform = False
dofatigue = False
doform = therower.showfresh
dofatigue = therower.showfit
if request.method == 'POST':
form = PerformanceManagerForm(request.POST)
@@ -1572,6 +1572,9 @@ def performancemanager_view(request,userid=0,mode='rower',
metricchoice = form.cleaned_data['metricchoice']
dofatigue = form.cleaned_data['dofatigue']
doform = form.cleaned_data['doform']
therower.showfresh = doform
therower.showfatigue = dofatigue
therower.save()
else:
form = PerformanceManagerForm()
@@ -1600,7 +1603,7 @@ def performancemanager_view(request,userid=0,mode='rower',
'script':script,
'div':thediv,
})
return(HttpResponse(response,content_type='application/json'))

View File

@@ -570,9 +570,13 @@ def rower_prefs_view(request,userid=0,message=""):
if cpform.is_valid():
cd = cpform.cleaned_data
cprange = cd['cprange']
kfit = cd['kfit']
kfatigue = cd['kfatigue']
r.cprange = cprange
r.kfit = kfit
r.kfatigue = kfatigue
r.save()
messages.info(request,'Updated CP range value')
messages.info(request,'Updated CP range and time decay constants')
success = dataprep.update_rolling_cp(r,mytypes.otwtypes,'water')
success = dataprep.update_rolling_cp(r,mytypes.otetypes,'erg')