diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 83cf6b15..7d12f7f7 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -1040,6 +1040,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower', barchart=True, otwpower=True, empower=True, inboard=inboard) rscore,normp = workout_rscore(w) + trimp,hrtss = workout_trimp(w) isbreakthrough = False ishard = False diff --git a/rowers/dataprepnodjango.py b/rowers/dataprepnodjango.py index b164fbb1..da384fbd 100644 --- a/rowers/dataprepnodjango.py +++ b/rowers/dataprepnodjango.py @@ -853,6 +853,9 @@ def update_agegroup_db(age,sex,weightcategory,wcdurations,wcpower, delete_agegroup_db(age,sex,weightcategory,debug=debug) + wcdurations = [None if type(y) is float and np.isnan(y) else y for y in wcdurations] + wcpower = [None if type(y) is float and np.isnan(y) else y for y in wcpower] + df = pd.DataFrame( { 'duration':wcdurations, diff --git a/rowers/middleware.py b/rowers/middleware.py index 9a44b7fe..736af9c0 100644 --- a/rowers/middleware.py +++ b/rowers/middleware.py @@ -1,3 +1,4 @@ + from django.utils import timezone from rowers.models import Workout, PowerTimeFitnessMetric, Rower import datetime diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index ec66e7e2..9704b281 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -30,6 +30,7 @@ import numpy as np import dataprep import courses import iso8601 +from iso8601 import ParseError from rowers.tasks import handle_check_race_course def get_todays_micro(plan,thedate=date.today()): @@ -411,7 +412,7 @@ def get_dates_timeperiod(request,startdatestring='',enddatestring=''): startdatestring = request.GET.get('startdate') enddatestring = request.GET.get('enddate') - if startdate and enddate: + if startdatestring and enddatestring: startdate = dt.datetime.strptime(startdatestring,'%Y-%m-%d').date() enddate = dt.datetime.strptime(enddatestring,'%Y-%m-%d').date() return startdate,enddate diff --git a/rowers/templates/menu_plan.html b/rowers/templates/menu_plan.html index 8e8fbd43..83b6b01c 100644 --- a/rowers/templates/menu_plan.html +++ b/rowers/templates/menu_plan.html @@ -82,62 +82,6 @@

 

-
    -
  • - - -
      -
    • - - -
        -
      • - - Week - -
      • -
      • - - Month - -
      • -
      -
    • -
    • - - -
        -
      • - - Week - -
      • -
      • - - Month - -
      • -
      -
    • -
    • - - -
        -
      • - - Week - -
      • -
      • - - Month - -
      • -
      -
    • -
    -
  • -
{% if user.is_authenticated and user|is_manager %} diff --git a/rowers/templates/plannedsessions.html b/rowers/templates/plannedsessions.html index 41c18019..2055d467 100644 --- a/rowers/templates/plannedsessions.html +++ b/rowers/templates/plannedsessions.html @@ -8,170 +8,185 @@

Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}

-{% if plannedsessions %} -

- Click on session name to view, edit to change the session and on the - traffic light symbol to add workouts to the session -

- - - - - - - - - - - - - - - - - - {% for ps in plannedsessions %} - - - - - - - - - - - - {% if completeness|lookup:ps.id == 'partial' %} - - {% else %} - +
    +
  • +

    +
    +

StatusOn or AfterOn or BeforeNameTypeModeEditPlannedActual Completion Date -
- {% if completeness|lookup:ps.id == 'not done' %} - {% if ps.sessiontype != 'race' %} - -   - {% else %} -   - {% endif %} - {% elif completeness|lookup:ps.id == 'completed' %} - {% if ps.sessiontype != 'race' %} -   - {% else %} -   - {% endif %} - {% elif completeness|lookup:ps.id == 'partial' %} - {% if ps.sessiontype != 'race' %} -   - {% else %} -   - {% endif %} - {% else %} - {% if ps.sessiontype != 'race' %} -   - {% else %} -   - {% endif %} - {% endif %} - {{ ps.startdate|date:"Y-m-d" }} {{ ps.enddate|date:"Y-m-d" }} - {% if ps.sessiontype != 'race' %} - {% if ps.name != '' %} - {{ ps.name }} - {% else %} - Unnamed Session - {% endif %} - {% else %} - {% if ps.name != '' %} - {{ ps.name }} - {% else %} - Unnamed Race - {% endif %} - {% endif %} - {{ ps.get_sessiontype_display }} {{ ps.get_sessionmode_display }} - {% if ps.manager == request.user %} - Edit - {% else %} -   - {% endif %} - {{ ps.sessionvalue }} {{ actualvalue|lookup:ps.id }} {{ ps.sessionunit }} {{ completiondate|lookup:ps.id|date:"Y-m-d" }} {{ completiondate|lookup:ps.id|date:"Y-m-d" }}
+ {{ dateform.as_table }} +
+ + +

+ +
  • + {% if plannedsessions %} +

    + Click on session name to view, edit to change the session and on the + traffic light symbol to add workouts to the session +

    + + + + + + + + + + + + + + + + + + {% for ps in plannedsessions %} + + + + + + + + + + + + {% if completeness|lookup:ps.id == 'partial' %} + + {% else %} + + {% endif %} + + {% endfor %} + +
    StatusOn or AfterOn or BeforeNameTypeModeEditPlannedActual Completion Date +
    + {% if completeness|lookup:ps.id == 'not done' %} + {% if ps.sessiontype != 'race' %} + +   + {% else %} +   + {% endif %} + {% elif completeness|lookup:ps.id == 'completed' %} + {% if ps.sessiontype != 'race' %} +   + {% else %} +   + {% endif %} + {% elif completeness|lookup:ps.id == 'partial' %} + {% if ps.sessiontype != 'race' %} +   + {% else %} +   + {% endif %} + {% else %} + {% if ps.sessiontype != 'race' %} +   + {% else %} +   + {% endif %} + {% endif %} + {{ ps.startdate|date:"Y-m-d" }} {{ ps.enddate|date:"Y-m-d" }} + {% if ps.sessiontype != 'race' %} + {% if ps.name != '' %} + {{ ps.name }} + {% else %} + Unnamed Session + {% endif %} + {% else %} + {% if ps.name != '' %} + {{ ps.name }} + {% else %} + Unnamed Race + {% endif %} + {% endif %} + {{ ps.get_sessiontype_display }} {{ ps.get_sessionmode_display }} + {% if ps.manager == request.user %} + Edit + {% else %} +   + {% endif %} + {{ ps.sessionvalue }} {{ actualvalue|lookup:ps.id }} {{ ps.sessionunit }} {{ completiondate|lookup:ps.id|date:"Y-m-d" }} {{ completiondate|lookup:ps.id|date:"Y-m-d" }}
    + {% else %} + You have no planned workouts for this period. Planned workouts are created + by your coach if you are part of a team. You can create your own + planned workouts by purchasing the "Coach" or "Self-Coach" plans. + {% endif %} +

    + + Print View +

    +
  • +
  • + {% if unmatchedworkouts %} +

    Workouts that are not linked to any session

    +

    + + + + + + + + + + + + + + + {% for workout in unmatchedworkouts %} + + + + {% if workout.user.user == user or user == team.manager %} + {% if workout.name != '' %} + + {% else %} + + {% endif %} + {% else %} + {% if workout.name != '' %} + + {% else %} + + {% endif %} + {% endif %} + + + + + + + {% endfor %} + +
    Date Time Name Type Distance Duration Avg HR Max HR
    {{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }} + + {{ workout.name }} + + + No Name + {{ workout.name }}No Name {{ workout.workouttype }} {{ workout.distance }}m {{ workout.duration |durationprint:"%H:%M:%S.%f" }} {{ workout.averagehr }} {{ workout.maxhr }}
    + + {% endif %} - - {% endfor %} - - -{% else %} -You have no planned workouts for this period. Planned workouts are created -by your coach if you are part of a team. You can create your own -planned workouts by purchasing the "Coach" or "Self-Coach" plans. -{% endif %} -

    - - Print View -

    -{% if unmatchedworkouts %} -

    Workouts that are not linked to any session

    -

    - - - - - - - - - - - - - - - {% for workout in unmatchedworkouts %} - - - - {% if workout.user.user == user or user == team.manager %} - {% if workout.name != '' %} - - {% else %} - - {% endif %} - {% else %} - {% if workout.name != '' %} - - {% else %} - - {% endif %} - {% endif %} - - - - - - - {% endfor %} - -
    Date Time Name Type Distance Duration Avg HR Max HR
    {{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }} - - {{ workout.name }} - - - No Name - {{ workout.name }}No Name {{ workout.workouttype }} {{ workout.distance }}m {{ workout.duration |durationprint:"%H:%M:%S.%f" }} {{ workout.averagehr }} {{ workout.maxhr }}
    - - - {% endif %} -

    - +

    +
  • + {% endblock %} diff --git a/rowers/views.py b/rowers/views.py index 47b71963..f93683a3 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -14791,6 +14791,14 @@ def plannedsessions_view(request, }, ] + initial = { + 'startdate':startdate, + 'enddate':enddate, + } + + dateform = DateRangeForm(initial=initial) + + return render(request,'plannedsessions.html', { 'teams':get_my_teams(request.user), @@ -14798,6 +14806,7 @@ def plannedsessions_view(request, 'plannedsessions':sps, 'plan':trainingplan, 'active': 'nav-plan', + 'dateform':dateform, 'rower':r, 'timeperiod':timeperiod, 'completeness':completeness,