improving syncrecord functionality, now also for workout export
This commit is contained in:
@@ -405,6 +405,7 @@ def check_tp_workout_id(workout, location, attempts=5, debug=False, **kwargs):
|
||||
if status == 'Success':
|
||||
tpid = response.json()['WorkoutIds'][0]
|
||||
workout.uploadedtotp = tpid
|
||||
record = create_or_update_syncrecord(workout.user, workout, tpid=tpid)
|
||||
workout.save()
|
||||
|
||||
return 1
|
||||
@@ -432,6 +433,7 @@ def handle_workout_tp_upload(w, thetoken, tcxfilename, debug=False, **kwargs):
|
||||
return 0
|
||||
|
||||
w.uploadedtotp = res
|
||||
record = create_or_update_syncrecord(w.user, w, tpid=tpid)
|
||||
tpid = res
|
||||
w.save()
|
||||
os.remove(tcxfilename)
|
||||
@@ -729,7 +731,7 @@ def handle_sporttracks_sync(workoutid, url, headers, data, debug=False, **kwargs
|
||||
workout = Workout.objects.get(id=workoutid)
|
||||
workout.uploadedtosporttracks = id
|
||||
workout.save()
|
||||
|
||||
record = create_or_update_syncrecord(workout.user, workout, sporttracksid=id)
|
||||
|
||||
return 1
|
||||
|
||||
@@ -798,6 +800,7 @@ def handle_strava_sync(stravatoken,
|
||||
|
||||
workout.uploadedtostrava = res.id
|
||||
workout.save()
|
||||
record = create_or_update_syncrecord(workout.user, workout, stravaid=res.id)
|
||||
try:
|
||||
act = client.update_activity(res.id, activity_type=activity_type,
|
||||
description=description, device_name='Rowsandall.com')
|
||||
|
||||
Reference in New Issue
Block a user