Private
Public Access
1
0

better power zones

This commit is contained in:
Sander Roosendaal
2022-12-15 22:10:37 +01:00
parent 98f2ff2707
commit 47d8dd63d3
6 changed files with 134 additions and 103 deletions

View File

@@ -618,13 +618,23 @@ def rower_prefs_view(request, userid=0, message=""):
hrftp = int((r.an+r.tr)/2.)
ftp = cd['ftp']
otwslack = cd['otwslack']
cogganzones = cd['cogganzones']
powerfrac = 100*np.array([r.pw_ut2,
r.pw_ut1,
r.pw_at,
r.pw_tr, r.pw_an])/r.ftp
if cogganzones:
powerfrac = np.array([55.,75.,90.,105.,120.])
powerzones = ['Rest',
'Active Recovery',
'Endurance',
'Tempo',
'Threshold',
'Anaerobic']
r.powerzones = powerzones
r.ftp = max(min(ftp, 650), 50)
r.otwslack = max(min(otwslack, 50), 0)
ut2, ut1, at, tr, an = (r.ftp*powerfrac/100.).astype(int)
r.pw_ut2 = ut2
r.pw_ut1 = ut1
@@ -632,7 +642,10 @@ def rower_prefs_view(request, userid=0, message=""):
r.pw_tr = tr
r.pw_an = an
r.hrftp = hrftp
r.otwslack = max(min(otwslack, 50), 0)
r.save()
powerzonesform = RowerPowerZonesForm(instance=r)
message = "FTP and/or OTW slack values changed."
messages.info(request, message)