From 8556a28d4ef367a0c99fd3714d049fe83c77f0cc Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 14 Apr 2019 17:43:18 -0400 Subject: [PATCH] fixed --- paidplans.json | 1 + rowers/stravastuff.py | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 paidplans.json diff --git a/paidplans.json b/paidplans.json new file mode 100644 index 00000000..2abd7eb6 --- /dev/null +++ b/paidplans.json @@ -0,0 +1 @@ +[{"model": "rowers.paidplan", "pk": 1, "fields": {"shortname": "basic", "name": "Basic", "external_id": null, "price": 0.0, "paymentprocessor": "paypal", "paymenttype": "single", "active": true, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 2, "fields": {"shortname": "pro", "name": "Pro (recurring)", "external_id": "pv5r", "price": 25.0, "paymentprocessor": "braintree", "paymenttype": "recurring", "active": true, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 3, "fields": {"shortname": "pro", "name": "Pro (one year)", "external_id": null, "price": 25.0, "paymentprocessor": "paypal", "paymenttype": "single", "active": false, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 4, "fields": {"shortname": "coach", "name": "Coach (4 athletes or less - recurring)", "external_id": null, "price": 90.0, "paymentprocessor": "paypal", "paymenttype": "recurring", "active": true, "clubsize": 4}}, {"model": "rowers.paidplan", "pk": 5, "fields": {"shortname": "plan", "name": "Self-Coach (recurring)", "external_id": null, "price": 75.0, "paymentprocessor": "paypal", "paymenttype": "recurring", "active": true, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 6, "fields": {"shortname": "coach", "name": "Coach (4-10 athletes, recurring)", "external_id": null, "price": 200.0, "paymentprocessor": "paypal", "paymenttype": "recurring", "active": true, "clubsize": 10}}, {"model": "rowers.paidplan", "pk": 7, "fields": {"shortname": "coach", "name": "Coach (more than 10 athletes, recurring)", "external_id": null, "price": 450.0, "paymentprocessor": "paypal", "paymenttype": "recurring", "active": true, "clubsize": 100}}, {"model": "rowers.paidplan", "pk": 8, "fields": {"shortname": "plan", "name": "Self-Coach (one year)", "external_id": null, "price": 75.0, "paymentprocessor": "paypal", "paymenttype": "single", "active": false, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 9, "fields": {"shortname": "coach", "name": "Coach (4 athletes or less - one year)", "external_id": null, "price": 120.0, "paymentprocessor": "paypal", "paymenttype": "single", "active": false, "clubsize": 4}}, {"model": "rowers.paidplan", "pk": 10, "fields": {"shortname": "coach", "name": "Coach (4-10 athletes, one year)", "external_id": null, "price": 250.0, "paymentprocessor": "paypal", "paymenttype": "single", "active": false, "clubsize": 10}}, {"model": "rowers.paidplan", "pk": 11, "fields": {"shortname": "coach", "name": "Coach (more than 10 athletes, one year)", "external_id": null, "price": 500.0, "paymentprocessor": "paypal", "paymenttype": "single", "active": false, "clubsize": 100}}, {"model": "rowers.paidplan", "pk": 12, "fields": {"shortname": "basic", "name": "Basic", "external_id": null, "price": 0.0, "paymentprocessor": "braintree", "paymenttype": "single", "active": true, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 13, "fields": {"shortname": "pro", "name": "Pro (recurring)", "external_id": null, "price": 25.0, "paymentprocessor": "paypal", "paymenttype": "recurring", "active": true, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 14, "fields": {"shortname": "pro", "name": "Pro (one year)", "external_id": "c6ww", "price": 25.0, "paymentprocessor": "braintree", "paymenttype": "single", "active": false, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 15, "fields": {"shortname": "coach", "name": "Coach (4 athletes or less - recurring)", "external_id": "hp9r", "price": 90.0, "paymentprocessor": "braintree", "paymenttype": "recurring", "active": true, "clubsize": 4}}, {"model": "rowers.paidplan", "pk": 16, "fields": {"shortname": "plan", "name": "Self-Coach (recurring)", "external_id": "s596", "price": 75.0, "paymentprocessor": "braintree", "paymenttype": "recurring", "active": true, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 17, "fields": {"shortname": "coach", "name": "Coach (4-10 athletes, recurring)", "external_id": "qngw", "price": 200.0, "paymentprocessor": "braintree", "paymenttype": "recurring", "active": true, "clubsize": 10}}, {"model": "rowers.paidplan", "pk": 18, "fields": {"shortname": "coach", "name": "Coach (more than 10 athletes, recurring)", "external_id": "mnwb", "price": 450.0, "paymentprocessor": "braintree", "paymenttype": "recurring", "active": true, "clubsize": 100}}, {"model": "rowers.paidplan", "pk": 19, "fields": {"shortname": "plan", "name": "Self-Coach (one year)", "external_id": "3qxg", "price": 75.0, "paymentprocessor": "braintree", "paymenttype": "single", "active": false, "clubsize": 0}}, {"model": "rowers.paidplan", "pk": 20, "fields": {"shortname": "coach", "name": "Coach (4 athletes or less - one year)", "external_id": "9q4m", "price": 120.0, "paymentprocessor": "braintree", "paymenttype": "single", "active": false, "clubsize": 4}}, {"model": "rowers.paidplan", "pk": 21, "fields": {"shortname": "coach", "name": "Coach (4-10 athletes, one year)", "external_id": "6qj2", "price": 250.0, "paymentprocessor": "braintree", "paymenttype": "single", "active": false, "clubsize": 10}}, {"model": "rowers.paidplan", "pk": 22, "fields": {"shortname": "coach", "name": "Coach (more than 10 athletes, one year)", "external_id": "dpq6", "price": 500.0, "paymentprocessor": "braintree", "paymenttype": "single", "active": false, "clubsize": 100}}] \ No newline at end of file diff --git a/rowers/stravastuff.py b/rowers/stravastuff.py index 87d8f185..65491db1 100644 --- a/rowers/stravastuff.py +++ b/rowers/stravastuff.py @@ -316,11 +316,10 @@ def get_workout(user,stravaid): latlongjson = get_strava_stream(r,'latlng',stravaid) powerjson = get_strava_stream(r,'power',stravaid) - try: t = np.array(timejson.json()[0]['data']) nr_rows = len(t) - d = np.array(distancejson.json()[1]['data']) + d = np.array(distancejson.json()[0]['data']) if nr_rows == 0: return (0,"Error: Time data had zero length") @@ -331,24 +330,24 @@ def get_workout(user,stravaid): return (0,"something went wrong with the Strava import") try: - spm = np.array(spmjson.json()[1]['data']) + spm = np.array(spmjson.json()[0]['data']) except: spm = np.zeros(nr_rows) try: - power = np.array(powerjson.json()[1]['data']) + power = np.array(powerjson.json()[0]['data']) except IndexError: power = np.zeros(nr_rows) try: - hr = np.array(hrjson.json()[1]['data']) + hr = np.array(hrjson.json()[0]['data']) except IndexError: hr = np.zeros(nr_rows) except KeyError: hr = np.zeros(nr_rows) try: - velo = np.array(velojson.json()[1]['data']) + velo = np.array(velojson.json()[0]['data']) except IndexError: velo = np.zeros(nr_rows) except KeyError: @@ -389,7 +388,6 @@ def get_workout(user,stravaid): 'power':power, 'strokelength':strokelength, }) - # startdatetime = datetime.datetime.strptime(startdatetime,"%Y-%m-%d-%H:%M:%S")