From e217446b3112ded85f3ce291b9ef4bee7336a425 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 21 Feb 2019 17:51:51 +0100 Subject: [PATCH] closing payments page for coaches --- rowers/stravastuff.py | 5 +- rowers/teams.py | 4 +- rowers/templates/billing.html | 2 +- rowers/templates/downgrade.html | 2 +- rowers/templates/downgrade_completed.html | 2 +- rowers/templates/downgradeconfirm.html | 2 +- rowers/templates/menu_analytics.html | 2 +- rowers/templates/menu_other.html | 51 +++++++++++ rowers/templates/menu_payments.html | 41 +++++++++ rowers/templates/menu_profile.html | 2 +- rowers/templates/menu_workouts.html | 6 +- rowers/templates/payment_completed.html | 2 +- rowers/templates/paymentconfirm.html | 2 +- rowers/templates/subscriptions_cancel.html | 2 +- rowers/templates/transactions.html | 2 +- rowers/templates/upgrade.html | 2 +- rowers/templates/upgradeconfirm.html | 2 +- rowers/templatetags/rowerfilters.py | 4 +- rowers/tests/test_urls.py | 48 +++++----- rowers/tests/testdata/testdata.csv.gz | Bin 12525 -> 12537 bytes rowers/urls.py | 99 +++++++++++---------- rowers/views/paymentviews.py | 30 +++---- rowers/views/workoutviews.py | 4 +- templates/400.html | 2 +- templates/403.html | 2 +- templates/404.html | 2 +- templates/500.html | 2 +- templates/502.html | 2 +- 28 files changed, 213 insertions(+), 113 deletions(-) create mode 100644 rowers/templates/menu_other.html create mode 100644 rowers/templates/menu_payments.html diff --git a/rowers/stravastuff.py b/rowers/stravastuff.py index f4b60fa7..2c8a9505 100644 --- a/rowers/stravastuff.py +++ b/rowers/stravastuff.py @@ -291,7 +291,10 @@ def get_workout(user,stravaid): workoutsummary = requests.get(url,headers=headers).json() workoutsummary['timezone'] = "Etc/UTC" - startdatetime = workoutsummary['start_date'] + try: + startdatetime = workoutsummary['start_date'] + except KeyError: + startdatetime = timezone.now() spmjson = get_strava_stream(r,'cadence',stravaid) hrjson = get_strava_stream(r,'heartrate',stravaid) diff --git a/rowers/teams.py b/rowers/teams.py index 76a9127b..d934b446 100644 --- a/rowers/teams.py +++ b/rowers/teams.py @@ -173,7 +173,9 @@ def rower_get_coaches(rower): def coach_getcoachees(coach): if coach.mycoachgroup and coach.rowerplan == 'coach': - return Rower.objects.filter(coachinggroups__in=[coach.mycoachgroup]).distinct() + return Rower.objects.filter( + coachinggroups__in=[coach.mycoachgroup] + ).distinct().order_by("user__last_name","user__first_name") else: return [] diff --git a/rowers/templates/billing.html b/rowers/templates/billing.html index ef442cb3..be3ba675 100644 --- a/rowers/templates/billing.html +++ b/rowers/templates/billing.html @@ -45,6 +45,6 @@ {% endblock %} {% block sidebar %} -{% include 'menu_profile.html' %} +{% include 'menu_payments.html' %} {% endblock %} diff --git a/rowers/templates/downgrade.html b/rowers/templates/downgrade.html index 7e5fe130..2ad91f7e 100644 --- a/rowers/templates/downgrade.html +++ b/rowers/templates/downgrade.html @@ -57,6 +57,6 @@ {% endblock %} {% block sidebar %} -{% include 'menu_profile.html' %} +{% include 'menu_payments.html' %} {% endblock %} diff --git a/rowers/templates/downgrade_completed.html b/rowers/templates/downgrade_completed.html index 4ede1451..c7fc85f2 100644 --- a/rowers/templates/downgrade_completed.html +++ b/rowers/templates/downgrade_completed.html @@ -21,6 +21,6 @@ {% endblock %} {% block sidebar %} -{% include 'menu_profile.html' %} +{% include 'menu_payments.html' %} {% endblock %} diff --git a/rowers/templates/downgradeconfirm.html b/rowers/templates/downgradeconfirm.html index 4b76a6d9..a465be46 100644 --- a/rowers/templates/downgradeconfirm.html +++ b/rowers/templates/downgradeconfirm.html @@ -98,6 +98,6 @@ {% endblock %} {% block sidebar %} -{% include 'menu_profile.html' %} +{% include 'menu_payments.html' %} {% endblock %} diff --git a/rowers/templates/menu_analytics.html b/rowers/templates/menu_analytics.html index 07c6d218..7d76a4be 100644 --- a/rowers/templates/menu_analytics.html +++ b/rowers/templates/menu_analytics.html @@ -68,7 +68,7 @@ -{% if user.is_authenticated and user|is_manager %} +{% if user.is_authenticated and user|is_manager and rower %}

 

{% if user|coach_rowers %} diff --git a/rowers/templates/menu_other.html b/rowers/templates/menu_other.html new file mode 100644 index 00000000..fad56ed0 --- /dev/null +++ b/rowers/templates/menu_other.html @@ -0,0 +1,51 @@ +{% load staticfiles %} +{% load rowerfilters %} +

Workouts

+ + + + + +{% include 'menuscript.html' %} diff --git a/rowers/templates/menu_payments.html b/rowers/templates/menu_payments.html new file mode 100644 index 00000000..91940095 --- /dev/null +++ b/rowers/templates/menu_payments.html @@ -0,0 +1,41 @@ +{% load staticfiles %} +{% load rowerfilters %} +

Profile

+ + + + +{% include 'menuscript.html' %} diff --git a/rowers/templates/menu_profile.html b/rowers/templates/menu_profile.html index 3863b35e..e3702374 100644 --- a/rowers/templates/menu_profile.html +++ b/rowers/templates/menu_profile.html @@ -37,7 +37,7 @@ -{% if user.is_authenticated and user|is_manager %} +{% if user.is_authenticated and user|is_manager and rower %}

 

{% if user|coach_rowers %}