From da5611005a40f51790d7a819b870a6e46719af94 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 23 Mar 2021 10:20:26 +0100 Subject: [PATCH] cosmetic changes in training plan presentation --- rowers/templates/instantplan.html | 11 ++++++++--- rowers/templates/instantplans.html | 9 ++++++--- rowers/utils.py | 4 +++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/rowers/templates/instantplan.html b/rowers/templates/instantplan.html index 0295251a..2883a0c9 100644 --- a/rowers/templates/instantplan.html +++ b/rowers/templates/instantplan.html @@ -17,11 +17,16 @@

{% endif %}

Plan length: {{ plan.duration }} days

+ {% if plan.description %}

{{ plan.description }}

-

{{ plan.target }}

+ {% endif %} + {% if plan.goal %}

Goal: {{ plan.goal }}

-

{{ plan.hoursperweek }} hours per week

-

{{ plan.sessionsperweek }} sessions per week

+ {% endif %} + {% if plan.target %} +

What the plan will achieve: {{ plan.target }}

+ {% endif %} +

Weekly volume: {{ plan.hoursperweek }} hours per week over {{ plan.sessionsperweek }} sessions.

  • diff --git a/rowers/templates/instantplans.html b/rowers/templates/instantplans.html index 920b2aa0..38a8146b 100644 --- a/rowers/templates/instantplans.html +++ b/rowers/templates/instantplans.html @@ -15,10 +15,13 @@

    Created by: {{ plan.owner.first_name }} {{ plan.owner.last_name }}

    Plan length: {{ plan.duration }} days

    {{ plan.description }}

    -

    {{ plan.target }}

    + {% if plan.target %} +

    What the plan will achieve: {{ plan.target }}

    + {% endif %} + {% if plan.goal %}

    Goal: {{ plan.goal }}

    -

    {{ plan.hoursperweek }} hours per week

    -

    {{ plan.sessionsperweek }} sessoins per week

    + {% endif %} +

    {{ plan.hoursperweek }} hours per week over {{ plan.sessionsperweek }} sessions

  • {% endfor %} diff --git a/rowers/utils.py b/rowers/utils.py index cf94570e..716af58c 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -25,6 +25,7 @@ import requests from django.http import HttpResponse +import humanize lbstoN = 4.44822 @@ -793,8 +794,9 @@ def step_to_string(step,short=False): unit = 'min' value = step['durationValue'] if value/1000. >= 3600: - unit = 'hour' + unit = 'h' dd = timedelta(seconds=value/1000.) + #duration = humanize.naturaldelta(dd, minimum_unit="seconds") duration = '{v}'.format(v=str(dd)) elif durationtype == 'Distance': unit = 'm'