diff --git a/rowers/forms.py b/rowers/forms.py index 9555f701..baf5782d 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -742,6 +742,8 @@ class PowerIntervalUpdateForm(forms.Form): required=True, initial='power', label='Use') + activeminutesmin = forms.IntegerField(required=False,initial=0,widget=forms.HiddenInput()) + activeminutesmax = forms.IntegerField(required=False,initial=0,widget=forms.HiddenInput()) # Form used to update interval stats class IntervalUpdateForm(forms.Form): diff --git a/rowers/templates/summary_edit.html b/rowers/templates/summary_edit.html index 57c9804d..66b2bbad 100644 --- a/rowers/templates/summary_edit.html +++ b/rowers/templates/summary_edit.html @@ -7,6 +7,27 @@ {% block scripts %} {% include "monitorjobs.html" %} + + + + {% endblock %} {% block main %} @@ -47,22 +68,28 @@ {{ form.as_table }} {% csrf_token %} - +

Intervals by Power/Pace

- +

With this form, you can specify a power or pace level. Everything faster/harder than the specified pace/power will become a work interval. Everything slower will become a rest - interval. + interval. Use the slider to limit the active range. Everything outside the active range will + become rest (warming up and cooling down).

- +
+
+

+ + +

{{ powerupdateform.as_table }}
{% csrf_token %} - +
  • @@ -70,7 +97,7 @@ - + {{ interactiveplot |safe }} {{ the_div |safe }} @@ -106,7 +133,7 @@

    Detailed Summary Edit

    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.

    - +
    @@ -131,18 +158,18 @@
    #TimeDistanceType
    {% csrf_token %} - +
  • Interval Shorthand How-To

    This is a quick way to enter the intervals using a special mini-language.

    You enter something like 8x500m/3min, 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.

    - +

    Special characters are x (times), + and / (denotes a rest interval), as well as ( and ). Units are min (minutes), sec (seconds), m (meters) and km (km).

    - +

    A typical interval is described as "10min/5min", with the work part before the "/" and the rest part after it. A zero rest can be omitted, so a single 1000m piece could be described either as "1km" or "1000m". The basic units can be combined with "+" and "Nx". You can use parentheses as in the example below.

    - +

    Here are a few examples.

    diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index 3ebd09e3..a5e49ab5 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -5605,6 +5605,9 @@ def workout_summary_edit_view(request,id,message="",successmessage="" return HttpResponse("Error: CSV Data File Not Found") nrintervals = len(idist) + activeminutesmax = int(rowdata.duration/60.) + activeminutesmin = 0 + maxminutes = activeminutesmax savebutton = 'nosavebutton' formvalues = {} @@ -5638,6 +5641,8 @@ def workout_summary_edit_view(request,id,message="",successmessage="" 'selector': 'power', 'work': int(normw), 'spm': int(normspm), + 'activeminutesmin': 0, + 'activeminutesmax': activeminutesmax, } powerorpace = 'power' @@ -5673,6 +5678,8 @@ def workout_summary_edit_view(request,id,message="",successmessage="" value_power = request.POST['value_power'] value_work = request.POST['value_work'] value_spm = request.POST['value_spm'] + activeminutesmin = request.POST['activeminutesmin'] + activeminutesmax = request.POST['activeminutesmax'] if powerorpace == 'power': try: power = int(value_power) @@ -5745,7 +5752,9 @@ def workout_summary_edit_view(request,id,message="",successmessage="" 'pace': datetime.timedelta(seconds=int(pace_secs)), 'work': work, 'selector': powerorpace, - 'spm': int(normspm) + 'spm': int(normspm), + 'activeminutesmin': activeminutesmin, + 'activeminutesmax': activeminutesmax, } form = SummaryStringForm() powerupdateform = PowerIntervalUpdateForm(initial=data) @@ -5792,6 +5801,8 @@ def workout_summary_edit_view(request,id,message="",successmessage="" 'selector': 'power', 'work': int(normw), 'spm': int(normspm), + 'activeminutesmin': 0, + 'activeminutesmax': activeminutesmax, }) savebutton = 'savestringform' @@ -5805,6 +5816,8 @@ def workout_summary_edit_view(request,id,message="",successmessage="" pace = cd['pace'] work = cd['work'] spm = cd['spm'] + activeminutesmin = cd['activeminutesmin'] + activeminutesmax = cd['activeminutesmax'] try: pace_secs = pace.seconds+pace.microseconds/1.0e6 except AttributeError: @@ -5849,6 +5862,8 @@ def workout_summary_edit_view(request,id,message="",successmessage="" 'value_pace': pace_secs, 'value_work': work, 'value_spm': spm, + 'activeminutesmin': activeminutesmin, + 'activeminutesmax': activeminutesmax, } powerupdateform = PowerIntervalUpdateForm(initial=cd) form = SummaryStringForm() @@ -5917,6 +5932,8 @@ def workout_summary_edit_view(request,id,message="",successmessage="" 'selector': 'power', 'work': int(normw), 'spm': int(normspm), + 'activeminutesmin': 0, + 'activeminutesmax': activeminutesmax, }) @@ -6000,6 +6017,9 @@ def workout_summary_edit_view(request,id,message="",successmessage="" return render(request, 'summary_edit.html', {'form':form, + 'activeminutesmax':activeminutesmax, + 'activeminutesmin':activeminutesmin, + 'maxminutes': maxminutes, 'detailform':detailform, 'powerupdateform':powerupdateform, 'workout':row,