adding customizable HR zones
This commit is contained in:
@@ -121,7 +121,7 @@ from rowers.models import (
|
||||
VirtualRaceFollower,
|
||||
)
|
||||
from rowers.models import (
|
||||
RowerPowerForm,RowerForm,RowerCPForm,GraphImage,AdvancedWorkoutForm,
|
||||
RowerPowerForm,RowerHRZonesForm,RowerForm,RowerCPForm,GraphImage,AdvancedWorkoutForm,
|
||||
RowerPowerZonesForm,AccountRowerForm,UserForm,
|
||||
Team,TeamForm,TeamInviteForm,TeamInvite,TeamRequest,
|
||||
WorkoutComment,WorkoutCommentForm,RowerExportForm,
|
||||
|
||||
@@ -489,13 +489,13 @@ def rower_prefs_view(request,userid=0,message=""):
|
||||
}
|
||||
]
|
||||
|
||||
form = RowerForm(instance=r)
|
||||
form = RowerHRZonesForm(instance=r)
|
||||
powerform = RowerPowerForm(instance=r)
|
||||
powerzonesform = RowerPowerZonesForm(instance=r)
|
||||
cpform = RowerCPForm(instance=r)
|
||||
|
||||
if request.method == 'POST' and "ut2" in request.POST:
|
||||
form = RowerForm(request.POST)
|
||||
form = RowerHRZonesForm(request.POST)
|
||||
if form.is_valid():
|
||||
# something
|
||||
cd = form.cleaned_data
|
||||
@@ -507,6 +507,16 @@ def rower_prefs_view(request,userid=0,message=""):
|
||||
an = cd['an']
|
||||
rest = cd['rest']
|
||||
|
||||
hrrestname = cd['hrrestname']
|
||||
hrut2name = cd['hrut2name']
|
||||
hrut1name = cd['hrut1name']
|
||||
hratname = cd['hratname']
|
||||
hrtrname = cd['hrtrname']
|
||||
hranname = cd['hranname']
|
||||
hrmaxname = cd['hrmaxname']
|
||||
hrzones = [hrrestname,hrut2name,hrut1name,hratname,hrtrname,hranname,hrmaxname]
|
||||
|
||||
|
||||
r.max = max(min(hrmax,250),10)
|
||||
r.ut2 = max(min(ut2,250),10)
|
||||
r.ut1 = max(min(ut1,250),10)
|
||||
@@ -514,6 +524,7 @@ def rower_prefs_view(request,userid=0,message=""):
|
||||
r.tr = max(min(tr,250),10)
|
||||
r.an = max(min(an,250),10)
|
||||
r.rest = max(min(rest,250),10)
|
||||
r.hrzones = hrzones
|
||||
r.save()
|
||||
successmessage = "Your Heart Rate data were changed"
|
||||
messages.info(request,successmessage)
|
||||
|
||||
Reference in New Issue
Block a user