From c3ad8a8500fe4e019cc7aeb9df84eacab5029238 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Wed, 15 Nov 2017 20:05:14 -0600 Subject: [PATCH 1/2] solving issue #232 and #234 --- rowers/templates/c2_list_import2.html | 11 ++++++++++- rowers/templates/workoutstats.html | 7 ++++++- rowers/views.py | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/rowers/templates/c2_list_import2.html b/rowers/templates/c2_list_import2.html index 434066b9..206d242e 100644 --- a/rowers/templates/c2_list_import2.html +++ b/rowers/templates/c2_list_import2.html @@ -46,14 +46,23 @@ {% for workout in workouts %} + {% if workout|lookup:'source' != 'Web' %} Import + {% else %} +   + {% endif %} {{ workout|lookup:'starttime' }} {{ workout|lookup:'duration' }} {{ workout|lookup:'distance' }} {{ workout|lookup:'rowtype' }} {{ workout|lookup:'source' }} {{ workout|lookup:'comment' }} - {{ workout|lookup:'new' }} + + {% if workout|lookup:'source' != 'Web' %} + {{ workout|lookup:'new' }} + {% else %} +   + {% endif %} {% endfor %} diff --git a/rowers/templates/workoutstats.html b/rowers/templates/workoutstats.html index 3a02f214..e58f15a4 100644 --- a/rowers/templates/workoutstats.html +++ b/rowers/templates/workoutstats.html @@ -78,7 +78,12 @@
 
-
+
+ +

rPower: Equivalent steady state power for the duration of the workout.

+

Heart Rate Drift: Comparing heart rate normalized for average power for the first and second half of the workout

+

rScore: Score based on rPower and workout duration to estimate training effect

+

Other Stats

diff --git a/rowers/views.py b/rowers/views.py index 3769f5a5..8fe5e197 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -8057,7 +8057,7 @@ def workout_getc2workout_all(request,page=1,message=""): messages.error(request,message) else: r = getrower(request.user) - c2ids = [item['id'] for item in res.json()['data']] + c2ids = [item['id'] for item in res.json()['data'] if item['source'] != 'Web'] knownc2ids = uniqify([ w.uploadedtoc2 for w in Workout.objects.filter(user=r) ]) From ebc7ff7e8a0a338f4094d66dc6a12e66897b42b6 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 16 Nov 2017 08:00:45 -0600 Subject: [PATCH 2/2] fixes bug in import all --- rowers/dataprep.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 6158431e..45cfd3d4 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -769,7 +769,11 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower', timezone=timezone_str, privacy=privacy) - w.save() + try: + w.save() + except ValidationError: + w.startdatetime = timezone.now() + w.save() isbreakthrough = False ishard = False