Private
Public Access
1
0

completed functionality and tested

This commit is contained in:
Sander Roosendaal
2017-03-24 10:49:54 +01:00
parent 44afa5ef47
commit 89f33ea804
4 changed files with 64 additions and 50 deletions

View File

@@ -1 +0,0 @@
E408191@CZ27LT9RCGN72.9372:1490257958

View File

@@ -201,7 +201,9 @@ def createrunkeeperworkoutdata(w):
for e in zip(t,lat,lon): for e in zip(t,lat,lon):
point = {'timestamp':e[0], point = {'timestamp':e[0],
'latitude':e[1], 'latitude':e[1],
'longitude':e[2],} 'longitude':e[2],
'altitude':0,
"type":"gps"}
locdata.append(point) locdata.append(point)
hrdata = [] hrdata = []
@@ -230,7 +232,7 @@ def createrunkeeperworkoutdata(w):
"average_heart_rate": averagehr, "average_heart_rate": averagehr,
"path": locdata, "path": locdata,
"distance": distancedata, "distance": distancedata,
"heartrate": hrdata, "heart_rate": hrdata,
"post_to_twitter":"false", "post_to_twitter":"false",
"post_to_facebook":"false", "post_to_facebook":"false",
} }
@@ -243,7 +245,7 @@ def createrunkeeperworkoutdata(w):
"notes": w.notes, "notes": w.notes,
"avg_heartrate": averagehr, "avg_heartrate": averagehr,
"distance": distancedata, "distance": distancedata,
"heartrate": hrdata, "heart_rate": hrdata,
"post_to_twitter":"false", "post_to_twitter":"false",
"post_to_facebook":"false", "post_to_facebook":"false",
} }

View File

@@ -3,62 +3,77 @@
{% block content %} {% block content %}
<div class="grid_6 alpha"> <div class="grid_6 alpha">
<h3>Import Workouts</h3> <h3>Import Workouts</h3>
<div class="grid_6"> <div class="grid_6">
<div class="grid_3 alpha"> <div class="grid_3 alpha">
<p> <p>
<a href="/rowers/workout/stravaimport"><img src="/static/img/stravalogo.png" alt="strava logo" width="140"></a> <a href="/rowers/workout/stravaimport"><img src="/static/img/stravalogo.png" alt="strava logo" width="140"></a>
</p> </p>
</div> </div>
<div class="grid_3 omega"> <div class="grid_3 omega">
<p>Import workouts from Strava</p> <p>Import workouts from Strava</p>
</div> </div>
</div> </div>
<div class="grid_6"> <div class="grid_6">
<div class="grid_3 alpha"> <div class="grid_3 alpha">
<p> <p>
<a href="/rowers/workout/c2import"><img src="/static/img/blueC2logo.png" alt="Concept2 logo" width="140"></a> <a href="/rowers/workout/c2import"><img src="/static/img/blueC2logo.png" alt="Concept2 logo" width="140"></a>
</p> </p>
</div> </div>
<div class="grid_3 omega"> <div class="grid_3 omega">
<p>Import workouts from the Concept2 logbook</p> <p>Import workouts from the Concept2 logbook</p>
</div> </div>
<div class="grid_3 alpha"> <div class="grid_3 alpha">
<p> <p>
<a href="/rowers/workout/sporttracksimport"><img src="/static/img/sporttracks-button.png" alt="SportTracks logo" width="140"></a> <a href="/rowers/workout/sporttracksimport"><img src="/static/img/sporttracks-button.png" alt="SportTracks logo" width="140"></a>
</p> </p>
</div> </div>
<div class="grid_3 omega"> <div class="grid_3 omega">
<p>Import workouts from SportTracks</p> <p>Import workouts from SportTracks</p>
</div> </div>
</div> </div>
<div class="grid_6">
<div class="grid_3 alpha">
<p>
<a href="/rowers/workout/runkeeperimport"><img src="/static/img/rk-logo.png" alt="Runkeeper logo" width="140"></a>
</p>
</div>
<div class="grid_3 omega">
<p>Import workouts from RunKeeper</p>
</div>
</div>
</div> </div>
<div class="grid_6 omega"> <div class="grid_6 omega">
<h3>Connect</h3> <h3>Connect</h3>
<div class="grid_6"> <div class="grid_6">
<p>Click one of the below logos to connect to the service of your choice. <p>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 You only need to do this once. After that, the site will have access until you
revoke the authorization for the "rowingdata" app.</p> revoke the authorization for the "rowingdata" app.</p>
<div class="grid_2 alpha"> <div class="grid_2 alpha">
<p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p> <p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p>
</div> </div>
<div class="grid_2"> <div class="grid_2">
<p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p> <p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
</div> </div>
<div class="grid_2 omega"> <div class="grid_2 omega">
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p> <p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
</div> </div>
</div> </div>
<div class="grid_6">
<div class="grid_2 alpha suffix_4">
<p><a href="/rowers/me/runkeeperauthorize/"><img src="/static/img/rk-logo.png" alt="connect with RunKeeper" width="120"></a></p>
</div>
</div>
</div> </div>
{% endblock content %} {% endblock content %}

View File

@@ -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 = datetime.datetime.strptime(data['date'],"%Y-%m-%d %H:%M:%S")
rowdatetime = thetimezone.localize(rowdatetime).astimezone(utc) rowdatetime = thetimezone.localize(rowdatetime).astimezone(utc)
starttimeunix = mktime(rowdatetime.utctimetuple()) starttimeunix = mktime(rowdatetime.utctimetuple())
startimeunix += utcoffset*3600 starttimeunix += utcoffset*3600
try: try:
@@ -1204,9 +1204,7 @@ def workout_runkeeper_upload_view(request,id=0):
return HttpResponseRedirect(url) return HttpResponseRedirect(url)
else: else:
s = response s = response
print dir(s) message = "Something went wrong in workout_runkeeper_upload_view: %s - %s" % (s.reason,s.text)
print s.text
message = "Something went wrong in workout_runkeeper_upload_view: %s" % s.reason
else: else:
message = "You are not authorized to upload this workout" message = "You are not authorized to upload this workout"