From e264ad6b3a8332dad63a6aceeb12fc281b85f7f3 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 5 Mar 2021 16:27:09 +0100 Subject: [PATCH 1/3] small improvement ui --- rowers/templates/templatelibrary.html | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/rowers/templates/templatelibrary.html b/rowers/templates/templatelibrary.html index 55754986..7fe46fa4 100644 --- a/rowers/templates/templatelibrary.html +++ b/rowers/templates/templatelibrary.html @@ -27,7 +27,7 @@

Sharing a session makes it available to all Rowsandall users on Self-Coach and Coach plans, so they can use it in their own training plans. You can make the session private again at any time, but users - can save your session in their own private libraries. + can save your session in their own private libraries. Click on the lock icon to toggle sharing/private.

@@ -36,11 +36,9 @@ - + - - @@ -59,9 +57,23 @@
Type Mode ValuePrivate/PublicPrivate/Shared Edit Copy to CalendarShareMake Private Delete
{{ ps.sessionvalue }} {{ ps.sessionunit }} {% if ps.is_public %} - + {% if ps.manager == request.user %} + + + + {% else %} + + {% endif %} {% else %} - + {% if ps.manager == request.user %} + + + + {% else %} + + {% endif %} {% endif %} From 70635452b0a6263e1849fb1e05ed788efdcc30a6 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 5 Mar 2021 17:07:28 +0100 Subject: [PATCH 2/3] bug fixes --- rowers/utils.py | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/rowers/utils.py b/rowers/utils.py index a20a1333..74633335 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -859,9 +859,18 @@ def step_to_string(step): targettype = None if targettype == 'HeartRate': - value = step['targetValue'] - valuelow = step['targetValueLow'] - valuehigh = step['targetValueHigh'] + try: + value = step['targetValue'] + except KeyError: + value = 0 + try: + valuelow = step['targetValueLow'] + except KeyError: + valuelow = 0 + try: + valuehigh = step['targetValueHigh'] + except KeyError: + valuehigh = 0 if value < 10 and value>0: target = 'Target: Heart Rate in zone {v}'.format(v=value) @@ -877,9 +886,17 @@ def step_to_string(step): h = valuehigh+100 ) elif targettype == 'Power': - value = step['targetValue'] - valuelow = step['targetValueLow'] - valuehigh = step['targetValueHigh'] + try: + value = step['targetValue'] + except KeyError: + value = 0 + try: + valuelow = step['targetValueLow'] + except KeyError: + valuelow = 0 + try: + valuehigh = step['targetValueHigh'] + except KeyError: if value < 10 and value>0: target = 'Target: Power in zone {v}'.format(v=value) @@ -895,9 +912,18 @@ def step_to_string(step): h = valuehigh-1000 ) elif targettype == 'Speed': - value = step['targetValue'] - valuelow = step['targetValueLow'] - valuehigh = step['targetValueHigh'] + try: + value = step['targetValue'] + except KeyError: + value = 0 + try: + valuelow = step['targetValueLow'] + except KeyError: + valuelow = 0 + try: + valuehigh = step['targetValueHigh'] + except KeyError: + valuehigh = 0 if value != 0: v = value/1000. From cf57fde485e873c59bfc97522b28ca6be52076c4 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 5 Mar 2021 17:16:12 +0100 Subject: [PATCH 3/3] fix --- rowers/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rowers/utils.py b/rowers/utils.py index 74633335..c12d71d5 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -897,6 +897,7 @@ def step_to_string(step): try: valuehigh = step['targetValueHigh'] except KeyError: + valuehigh = 0 if value < 10 and value>0: target = 'Target: Power in zone {v}'.format(v=value)