Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2018-06-21 21:56:26 +02:00
parent 3f44f0e8df
commit 40a4774178

View File

@@ -11295,6 +11295,10 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
normv,normw = dataprep.workout_normv(row,pp=8.0)
work = int(normw)
power = int(normp)
pace_secs = int(500./normv)
try:
avpace = datetime.timedelta(seconds=int(500./normv))
except:
@@ -11331,7 +11335,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
itime,idist,itype = rowdata.intervalstats_values()
nrintervals = len(idist)
savebutton = 'savestringform'
powerupdateform = PowerIntervalUpdateForm()
powerupdateform = PowerIntervalUpdateForm(initial=data)
# we are saving the results obtained from the split by power/pace interpreter
elif request.method == 'POST' and "savepowerpaceform" in request.POST:
@@ -11341,18 +11345,13 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
value_work = request.POST['value_work']
if powerorpace == 'power':
power = int(value_power)
pace_secs = 120.0
work = 400.
elif powerorpace == 'pace':
power = 0
try:
pace_secs = float(value_pace)
except ValueError:
pace_secs = float(value_pace.replace(',','.'))
elif powerorpace == 'work':
power = 0
work = int(value_work)
pace_secs = 120.0
if powerorpace == 'power' and power is not None:
try:
@@ -11372,7 +11371,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
elif powerorpace == 'work':
try:
rowdata.updateinterval_metric(
' WorkPerStroke (joules)',work,mode='larger',
'driveenergy',work,mode='larger',
debug=False,smoothwindow=15.)
except:
messages.error(request,'Error updating Work per Stroke')
@@ -11392,6 +11391,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
data = {
'power': power,
'pace': datetime.timedelta(seconds=int(pace_secs)),
'work': work,
'selector': powerorpace
}
form = SummaryStringForm()
@@ -11433,7 +11433,12 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
messages.info(request,"Updated interval data saved")
data = {'intervalstring':s}
form = SummaryStringForm(initial=data)
powerupdateform = PowerIntervalUpdateForm()
powerupdateform = PowerIntervalUpdateForm(initial={
'power': int(normp),
'pace': avpace,
'selector': 'power',
'work': int(normw)
})
savebutton = 'savestringform'
# we are saving the results obtained from the power update form
@@ -11539,7 +11544,13 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
messages.info(request,"Updated interval data saved")
form = SummaryStringForm()
powerupdateform = PowerIntervalUpdateForm()
powerupdateform = PowerIntervalUpdateForm(initial={
'power': int(normp),
'pace': avpace,
'selector': 'power',
'work': int(normw)
})
# we are processing the details form
elif request.method == 'POST' and "nrintervals" in request.POST: