From dcb207fb203db117a68d927326972649033e8907 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 8 Jun 2018 09:08:58 +0200 Subject: [PATCH 1/2] improved workout edit form --- rowers/templates/document_form.html | 2 +- rowers/templates/workout_form.html | 2 +- rowers/tests.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rowers/templates/document_form.html b/rowers/templates/document_form.html index 6c899e79..67e38300 100644 --- a/rowers/templates/document_form.html +++ b/rowers/templates/document_form.html @@ -85,7 +85,7 @@ $( document ).ready(function() { $(this).val() == 'rower' || $(this).val() == 'skierg' || $(this).val() == 'dynamic' - || $(this).val() == 'sliders' + || $(this).val() == 'slides' || $(this).val() == 'paddle' || $(this).val() == 'snow' ) { diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index 3cef35a9..21165f3a 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -26,7 +26,7 @@ $( document ).ready(function() { $(this).val() == 'rower' || $(this).val() == 'skierg' || $(this).val() == 'dynamic' - || $(this).val() == 'sliders' + || $(this).val() == 'slides' || $(this).val() == 'paddle' || $(this).val() == 'snow' ) { diff --git a/rowers/tests.py b/rowers/tests.py index cd504a4a..59afd8e3 100644 --- a/rowers/tests.py +++ b/rowers/tests.py @@ -450,6 +450,8 @@ class DataTest(TestCase): 'notes':'Aap noot \n mies', 'weightcategory':'lwt', 'workouttype':'water', + 'boattype':'1x', + 'private':False, } form = WorkoutForm(data=form_data) self.assertTrue(form.is_valid()) @@ -680,6 +682,8 @@ class ViewTest(TestCase): 'distance':'15000', 'weightcategory':'hwt', 'workouttype':'rower', + 'boattype':'1x', + 'private':True, 'notes':'noot mies', } form = WorkoutForm(data=form_data) From 15f489e08646a302784d88d6b3405693ddf39365 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 8 Jun 2018 09:35:11 +0200 Subject: [PATCH 2/2] bug fixes --- rowers/dataprep.py | 11 +++++------ rowers/templates/manualadd.html | 28 ++++++++++++++++++++++++++++ rowers/templates/workout_form.html | 2 +- rowers/views.py | 29 +++++++++++++++++++++-------- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index b00136ab..ca63cac2 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -748,9 +748,8 @@ def fetchcp(rower,theworkouts,table='cpdata'): # create a new workout from manually entered data -def create_row_df(r,distance,duration,startdatetime, - title = 'Manually added workout',notes='', - workouttype='rower'): +def create_row_df(r,distance,duration,startdatetime,workouttype='rower'): + nr_strokes = int(distance/10.) @@ -808,10 +807,10 @@ def create_row_df(r,distance,duration,startdatetime, row.write_csv(csvfilename, gzip = True) id, message = save_workout_database(csvfilename, r, - title=title, - notes=notes, +# title=title, +# notes=notes, dosmooth=False, - workouttype=workouttype, +# workouttype=workouttype, consistencychecks=False, totaltime=totalseconds) diff --git a/rowers/templates/manualadd.html b/rowers/templates/manualadd.html index 60540df9..b5dff315 100644 --- a/rowers/templates/manualadd.html +++ b/rowers/templates/manualadd.html @@ -6,6 +6,34 @@ {% get_current_timezone as TIME_ZONE %} + +{% block scripts %} + + + +{% endblock %} + {% block content %}

Add Workout Manually

diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index 21165f3a..fcd4b1d7 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -18,7 +18,7 @@ - +