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 @@
- {% 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 @@
- Click on session name to view, edit to change the session and on the - traffic light symbol to add workouts to the session -
-| Status | -On or After | -On or Before | -Name | -Type | -Mode | -Edit | -Planned | -Actual | -- | 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 }} | - {% if completeness|lookup:ps.id == 'partial' %} -{{ completiondate|lookup:ps.id|date:"Y-m-d" }} | - {% else %} -{{ completiondate|lookup:ps.id|date:"Y-m-d" }} | +
| Status | +On or After | +On or Before | +Name | +Type | +Mode | +Edit | +Planned | +Actual | ++ | 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 }} | + {% if completeness|lookup:ps.id == 'partial' %} +{{ completiondate|lookup:ps.id|date:"Y-m-d" }} | + {% else %} +{{ completiondate|lookup:ps.id|date:"Y-m-d" }} | + {% endif %} +
+ + Print View +
++
| Date | +Time | +Name | +Type | +Distance | +Duration | +Avg HR | +Max HR | +|||
|---|---|---|---|---|---|---|---|---|---|---|
| {{ workout.date|date:"Y-m-d" }} | +{{ workout.starttime|date:"H:i" }} | + {% if workout.user.user == user or user == team.manager %} + {% if workout.name != '' %} ++ + {{ workout.name }} + + | + {% else %} ++ No Name + | + {% endif %} + {% else %} + {% if workout.name != '' %} +{{ workout.name }} | + {% else %} +No Name | + {% endif %} + {% endif %} +{{ workout.workouttype }} | +{{ workout.distance }}m | +{{ workout.duration |durationprint:"%H:%M:%S.%f" }} | +{{ workout.averagehr }} | +{{ workout.maxhr }} | +
- - Print View -
-{% if unmatchedworkouts %} --
| Date | -Time | -Name | -Type | -Distance | -Duration | -Avg HR | -Max HR | -|||
|---|---|---|---|---|---|---|---|---|---|---|
| {{ workout.date|date:"Y-m-d" }} | -{{ workout.starttime|date:"H:i" }} | - {% if workout.user.user == user or user == team.manager %} - {% if workout.name != '' %} -- - {{ workout.name }} - - | - {% else %} -- No Name - | - {% endif %} - {% else %} - {% if workout.name != '' %} -{{ workout.name }} | - {% else %} -No Name | - {% endif %} - {% endif %} -{{ workout.workouttype }} | -{{ workout.distance }}m | -{{ workout.duration |durationprint:"%H:%M:%S.%f" }} | -{{ workout.averagehr }} | -{{ workout.maxhr }} | -