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

@@ -33,6 +33,16 @@
<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">
@@ -57,6 +67,11 @@ revoke the authorization for the "rowingdata" app.</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>

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"