From 89f33ea8043006f8e3b514b49e84fdfac9a432f6 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 24 Mar 2017 10:49:54 +0100 Subject: [PATCH] completed functionality and tested --- rowers/.#runkeeperstuff.py | 1 - rowers/runkeeperstuff.py | 8 +-- rowers/templates/imports.html | 99 ++++++++++++++++++++--------------- rowers/views.py | 6 +-- 4 files changed, 64 insertions(+), 50 deletions(-) delete mode 100644 rowers/.#runkeeperstuff.py diff --git a/rowers/.#runkeeperstuff.py b/rowers/.#runkeeperstuff.py deleted file mode 100644 index 8cbb2c1f..00000000 --- a/rowers/.#runkeeperstuff.py +++ /dev/null @@ -1 +0,0 @@ -E408191@CZ27LT9RCGN72.9372:1490257958 \ No newline at end of file diff --git a/rowers/runkeeperstuff.py b/rowers/runkeeperstuff.py index 25866bc8..b845bf20 100644 --- a/rowers/runkeeperstuff.py +++ b/rowers/runkeeperstuff.py @@ -201,7 +201,9 @@ def createrunkeeperworkoutdata(w): for e in zip(t,lat,lon): point = {'timestamp':e[0], 'latitude':e[1], - 'longitude':e[2],} + 'longitude':e[2], + 'altitude':0, + "type":"gps"} locdata.append(point) hrdata = [] @@ -230,7 +232,7 @@ def createrunkeeperworkoutdata(w): "average_heart_rate": averagehr, "path": locdata, "distance": distancedata, - "heartrate": hrdata, + "heart_rate": hrdata, "post_to_twitter":"false", "post_to_facebook":"false", } @@ -243,7 +245,7 @@ def createrunkeeperworkoutdata(w): "notes": w.notes, "avg_heartrate": averagehr, "distance": distancedata, - "heartrate": hrdata, + "heart_rate": hrdata, "post_to_twitter":"false", "post_to_facebook":"false", } diff --git a/rowers/templates/imports.html b/rowers/templates/imports.html index 640cae9a..6bfda942 100644 --- a/rowers/templates/imports.html +++ b/rowers/templates/imports.html @@ -3,62 +3,77 @@ {% block content %}
-

Import Workouts

+

Import Workouts

-
-
-

+

+
+

strava logo -

-
-
-

Import workouts from Strava

-
-
-
-
-

+

+
+
+

Import workouts from Strava

+
+
+
+
+

Concept2 logo -

-
-
-

Import workouts from the Concept2 logbook

-
-
-

+

+
+
+

Import workouts from the Concept2 logbook

+
+
+

SportTracks logo -

-
-
-

Import workouts from SportTracks

-
-
+

+
+
+

Import workouts from SportTracks

+
+
+
+
+

+ Runkeeper logo +

+
+
+

Import workouts from RunKeeper

+
+
-

Connect

+

Connect

-
-

Click one of the below logos to connect to the service of your choice. -You only need to do this once. After that, the site will have access until you -revoke the authorization for the "rowingdata" app.

+
+

Click one of the below logos to connect to the service of your choice. + You only need to do this once. After that, the site will have access until you + revoke the authorization for the "rowingdata" app.

-
-

connect with strava

+
+

connect with strava

-
-
-

connect with Concept2

-
+
+
+

connect with Concept2

+
-
-

connect with SportTracks

-
+
+

connect with SportTracks

+
-
+
+
+
+

connect with RunKeeper

+
+
{% endblock content %} - \ No newline at end of file + diff --git a/rowers/views.py b/rowers/views.py index 0f127a9d..4f803ea6 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -540,7 +540,7 @@ def add_workout_from_runkeeperdata(user,importid,data): rowdatetime = datetime.datetime.strptime(data['date'],"%Y-%m-%d %H:%M:%S") rowdatetime = thetimezone.localize(rowdatetime).astimezone(utc) starttimeunix = mktime(rowdatetime.utctimetuple()) - startimeunix += utcoffset*3600 + starttimeunix += utcoffset*3600 try: @@ -1204,9 +1204,7 @@ def workout_runkeeper_upload_view(request,id=0): return HttpResponseRedirect(url) else: s = response - print dir(s) - print s.text - message = "Something went wrong in workout_runkeeper_upload_view: %s" % s.reason + message = "Something went wrong in workout_runkeeper_upload_view: %s - %s" % (s.reason,s.text) else: message = "You are not authorized to upload this workout"