added links to strava, st, c2 under button
This commit is contained in:
@@ -449,6 +449,7 @@ def get_username(access_token):
|
||||
|
||||
try:
|
||||
res = me_json['data']['username']
|
||||
id = me_json['data']['id']
|
||||
except KeyError:
|
||||
res = None
|
||||
|
||||
@@ -482,7 +483,7 @@ def process_callback(request):
|
||||
|
||||
access_token = get_token(code)
|
||||
|
||||
username = get_username(access_token)
|
||||
username,id = get_username(access_token)
|
||||
|
||||
return HttpResponse("got a user name: %s" % username)
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ def handle_stravaexport(f2,workoutname,stravatoken,description=''):
|
||||
|
||||
act = client.upload_activity(f2,'tcx',name=workoutname)
|
||||
try:
|
||||
res = act.wait(poll_interval=5.0)
|
||||
res = act.wait(poll_interval=5.0,timeout=30)
|
||||
message = 'Workout successfully synchronized to Strava'
|
||||
except:
|
||||
res = 0
|
||||
@@ -246,6 +246,7 @@ def handle_stravaexport(f2,workoutname,stravatoken,description=''):
|
||||
act = client.update_activity(res.id,activity_type='Rowing',description=description)
|
||||
else:
|
||||
message = 'Strava upload timed out.'
|
||||
return (0,message)
|
||||
|
||||
return (res.id,message)
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ Click on the icon to upload this workout to your site of choice. A checkmark ind
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="grid_1 alpha">
|
||||
<a href="http://log.concept2.com/profile/{{ c2userid }}/log/{{ workout.uploadedtoc2 }}">
|
||||
<img src="/static/img/c2square_checked.png" alt="Concept2 icon" width="60" height="60"></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -59,6 +60,7 @@ Click on the icon to upload this workout to your site of choice. A checkmark ind
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="grid_1">
|
||||
<a href="https://www.strava.com/activities/{{ workout.uploadedtostrava }}">
|
||||
<img src="/static/img/stravasquare_checked.png" alt="Concept2 icon" width="60" height="60"></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -76,6 +78,7 @@ Click on the icon to upload this workout to your site of choice. A checkmark ind
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="grid_1">
|
||||
<a href="https://sporttracks.mobi/activity/{{ workout.uploadedtosporttracks }}">
|
||||
<img src="/static/img/sporttrackssquare_checked.png" alt="Concept2 icon" width="60" height="60"></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -810,7 +810,10 @@ def workout_strava_upload_view(request,id=0):
|
||||
message = mes
|
||||
w.uploadedtostrava = -1
|
||||
w.save()
|
||||
try:
|
||||
os.remove(tcxfile)
|
||||
except WindowsError:
|
||||
pass
|
||||
url = reverse(workout_export_view,
|
||||
kwargs = {
|
||||
'id':str(w.id),
|
||||
@@ -3423,6 +3426,16 @@ def workout_export_view(request,id=0, message="", successmessage=""):
|
||||
row = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
try:
|
||||
thetoken = c2_open(request.user)
|
||||
except C2NoTokenError:
|
||||
thetoken = 0
|
||||
|
||||
if (checkworkoutuser(request.user,row)) and thetoken:
|
||||
c2userid = c2stuff.get_userid(thetoken)
|
||||
else:
|
||||
c2userid = 0
|
||||
|
||||
form = WorkoutForm(instance=row)
|
||||
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
|
||||
@@ -3439,6 +3452,7 @@ def workout_export_view(request,id=0, message="", successmessage=""):
|
||||
'export.html',
|
||||
{'workout':row,
|
||||
'message':message,
|
||||
'successmessage':successmessage,
|
||||
'c2userid':c2userid,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user