removing detail form
This commit is contained in:
@@ -111,9 +111,6 @@
|
||||
{% for key,value in formvalues.items %}
|
||||
<input type="hidden" name="{{ key }}" value="{{ value|safe }}">
|
||||
{% endfor %}
|
||||
{% for field in detailform %}
|
||||
{{ field.as_hidden }}
|
||||
{% endfor %}
|
||||
<p>
|
||||
<input type="submit" value="Save">
|
||||
</p>
|
||||
@@ -130,38 +127,6 @@
|
||||
</p>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>Detailed Summary Edit</h1>
|
||||
<p>This is still experimental and there are known bugs. Use at your own risk. Nothing is stored permanently until you hit Save in the Updated Summary section. You can use the restore original button to restore the original values.</p>
|
||||
<form enctype="multipart/form-data" action="/rowers/workout/{{ workout.id|encode }}/editintervals/" method="post">
|
||||
<table width=100%>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th><th>Time</th><th>Distance</th><th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in nrintervals|times %}
|
||||
<tr>
|
||||
<td>{{ i }} </td>
|
||||
<td>
|
||||
{% get_field_id i "intervalt_" detailform %}
|
||||
</td>
|
||||
<td>
|
||||
{% get_field_id i "intervald_" detailform %}
|
||||
</td>
|
||||
<td>
|
||||
{% get_field_id i "type_" detailform %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="nrintervals" value={{ nrintervals }}>
|
||||
<input class="button" type="submit" value="Update">
|
||||
</form>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
<h1 id="howto">Interval Shorthand How-To</h1>
|
||||
<p>This is a quick way to enter the intervals using a special mini-language.</p>
|
||||
<p>You enter something like <em>8x500m/3min</em>, press "Update" and the site will interpret this for you and update the summary on the right. If you're happy with the result, press the green Save button to update the values. Nothing will be changed permanently until you hit Save.</p>
|
||||
|
||||
@@ -6425,133 +6425,9 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
}
|
||||
powerupdateform = PowerIntervalUpdateForm(initial=cd)
|
||||
form = SummaryStringForm(initial={'intervalstring':intervalString})
|
||||
|
||||
|
||||
|
||||
# we are saving the results obtained from the detailed form
|
||||
elif request.method == 'POST' and "savedetailform" in request.POST: # pragma: no cover
|
||||
savebutton = 'savedetailform'
|
||||
form = SummaryStringForm()
|
||||
nrintervals = int(request.POST['nrintervals'])
|
||||
detailform = IntervalUpdateForm(request.POST,aantal=nrintervals)
|
||||
itime = []
|
||||
idist = []
|
||||
itype = []
|
||||
ivalues = []
|
||||
iunits = []
|
||||
itypes = []
|
||||
iresults = []
|
||||
for i in range(nrintervals):
|
||||
try:
|
||||
t = datetime.datetime.strptime(request.POST['intervalt_%s' % i],"%H:%M:%S.%f")
|
||||
except ValueError:
|
||||
t = datetime.datetime.strptime(request.POST['intervalt_%s' % i],"%H:%M:%S")
|
||||
|
||||
timesecs = 3600*t.hour+60*t.minute+t.second+t.microsecond/1.e6
|
||||
itime += [timesecs]
|
||||
idist += [int(request.POST['intervald_%s' % i])]
|
||||
itype += [int(request.POST['type_%s' % i])]
|
||||
|
||||
if itype[i] == 3: # rest
|
||||
itypes += ['rest']
|
||||
ivalues += [timesecs]
|
||||
iresults += [idist[i]]
|
||||
iunits += ['seconds']
|
||||
if itype[i] == 5 or itype[i] == 2: # distance based work
|
||||
itypes += ['work']
|
||||
ivalues += [idist[i]]
|
||||
iresults += [timesecs]
|
||||
iunits += ['meters']
|
||||
if itype[i] == 4 or itype[i] == 1: # time based work
|
||||
itypes += ['work']
|
||||
ivalues += [timesecs]
|
||||
iresults += [idist[i]]
|
||||
iunits += ['seconds']
|
||||
|
||||
|
||||
rowdata.updateintervaldata(ivalues,iunits,itypes,iresults=iresults)
|
||||
intervalstats = rowdata.allstats()
|
||||
row.summary = intervalstats
|
||||
try:
|
||||
row.notes += "\n"+s
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
row.save()
|
||||
rowdata.write_csv(f1,gzip=True)
|
||||
dataprep.update_strokedata(encoder.decode_hex(id),rowdata.df)
|
||||
messages.info(request,"Updated interval data saved")
|
||||
|
||||
form = SummaryStringForm()
|
||||
powerupdateform = PowerIntervalUpdateForm(initial={
|
||||
'power': int(normp),
|
||||
'pace': avpace,
|
||||
'selector': 'power',
|
||||
'work': int(normw),
|
||||
'spm': int(normspm),
|
||||
'activeminutesmin': 0,
|
||||
'activeminutesmax': activeminutesmax,
|
||||
})
|
||||
|
||||
|
||||
# we are processing the details form
|
||||
elif request.method == 'POST' and "nrintervals" in request.POST: # pragma: no cover
|
||||
savebutton = 'savedetailform'
|
||||
nrintervals = int(request.POST['nrintervals'])
|
||||
detailform = IntervalUpdateForm(request.POST,aantal=nrintervals)
|
||||
if detailform.is_valid():
|
||||
cd = detailform.cleaned_data
|
||||
itime = []
|
||||
idist = []
|
||||
itype = []
|
||||
ivalues = []
|
||||
iunits = []
|
||||
itypes = []
|
||||
iresults = []
|
||||
for i in range(nrintervals):
|
||||
t = cd['intervalt_%s' % i]
|
||||
timesecs = t.total_seconds()
|
||||
itime += [timesecs]
|
||||
idist += [cd['intervald_%s' % i]]
|
||||
itype += [cd['type_%s' % i]]
|
||||
|
||||
if itype[i] == '3': # rest
|
||||
itypes += ['rest']
|
||||
ivalues += [timesecs]
|
||||
iresults += [idist[i]]
|
||||
iunits += ['seconds']
|
||||
if itype[i] == '5' or itype[i] == '2': # distance based work
|
||||
itypes += ['work']
|
||||
ivalues += [idist[i]]
|
||||
iresults += [timesecs]
|
||||
iunits += ['meters']
|
||||
if itype[i] == '4' or itype[i] == '1': # time based work
|
||||
itypes += ['work']
|
||||
ivalues += [timesecs]
|
||||
iresults += [idist[i]]
|
||||
iunits += ['seconds']
|
||||
|
||||
rowdata.updateintervaldata(ivalues,iunits,
|
||||
itypes,iresults=iresults)
|
||||
intervalstats = rowdata.allstats()
|
||||
|
||||
|
||||
form = SummaryStringForm()
|
||||
powerupdateform = PowerIntervalUpdateForm()
|
||||
|
||||
|
||||
|
||||
initial = {}
|
||||
for i in range(nrintervals):
|
||||
try:
|
||||
initial['intervald_%s' % i] = idist[i]
|
||||
initial['intervalt_%s' % i] = get_time(itime[i])
|
||||
initial['type_%s' % i] = itype[i]
|
||||
except IndexError: # pragma: no cover
|
||||
pass
|
||||
|
||||
|
||||
detailform = IntervalUpdateForm(aantal=nrintervals,initial=initial)
|
||||
|
||||
# create interactive plot
|
||||
try:
|
||||
@@ -6576,7 +6452,6 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
'activeminutesmax':activeminutesmax,
|
||||
'activeminutesmin':activeminutesmin,
|
||||
'maxminutes': maxminutes,
|
||||
'detailform':detailform,
|
||||
'powerupdateform':powerupdateform,
|
||||
'workout':row,
|
||||
'rower':r,
|
||||
|
||||
Reference in New Issue
Block a user