bug fixes
This commit is contained in:
@@ -323,19 +323,20 @@ def handle_sporttracks_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
|||||||
def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,description,debug=False,**kwargs):
|
def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,description,debug=False,**kwargs):
|
||||||
client = stravalib.Client(access_token=stravatoken)
|
client = stravalib.Client(access_token=stravatoken)
|
||||||
failed = False
|
failed = False
|
||||||
with open(filename,'rb') as f:
|
try:
|
||||||
try:
|
with open(filename,'rb') as f:
|
||||||
act = client.upload_activity(f,'tcx.gz',name=name)
|
|
||||||
try:
|
try:
|
||||||
res = act.wait(poll_interval=1.0, timeout=60)
|
act = client.upload_activity(f,'tcx.gz',name=name)
|
||||||
except stravalib.exc.ActivityUploadFailed: # pragma: no cover
|
try:
|
||||||
|
res = act.wait(poll_interval=1.0, timeout=60)
|
||||||
|
except stravalib.exc.ActivityUploadFailed: # pragma: no cover
|
||||||
|
failed = True
|
||||||
|
except JSONDecodeError: # pragma: no cover
|
||||||
|
failed = True
|
||||||
|
except stravalib.exc.ObjectNotFound: # pragma: no cover
|
||||||
|
failed = True
|
||||||
|
except ActivityUploadFailed: # pragma: no cover
|
||||||
failed = True
|
failed = True
|
||||||
except JSONDecodeError: # pragma: no cover
|
|
||||||
failed = True
|
|
||||||
except stravalib.exc.ObjectNotFound: # pragma: no cover
|
|
||||||
failed = True
|
|
||||||
except ActivityUploadFailed: # pragma: no cover
|
|
||||||
failed = True
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
failed = True
|
failed = True
|
||||||
|
|
||||||
@@ -3489,7 +3490,7 @@ def fetch_strava_workout(stravatoken,oauth_data,stravaid,csvfilename,userid,debu
|
|||||||
'strokelength':strokelength,
|
'strokelength':strokelength,
|
||||||
})
|
})
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
workouttype = mytypes.stravamappinginv[workoutsummary['type']]
|
workouttype = mytypes.stravamappinginv[workoutsummary['type']]
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Normal file
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Normal file
Binary file not shown.
@@ -862,8 +862,10 @@ def workout_rp3import_view(request,userid=0):
|
|||||||
|
|
||||||
workouts_list = pd.json_normalize(res.json()['data']['workouts'])
|
workouts_list = pd.json_normalize(res.json()['data']['workouts'])
|
||||||
|
|
||||||
|
try:
|
||||||
rp3ids = workouts_list['id'].values
|
rp3ids = workouts_list['id'].values
|
||||||
|
except KeyError:
|
||||||
|
rp3ids = []
|
||||||
|
|
||||||
knownrp3ids = uniqify([
|
knownrp3ids = uniqify([
|
||||||
w.uploadedtorp3 for w in Workout.objects.filter(user=r)
|
w.uploadedtorp3 for w in Workout.objects.filter(user=r)
|
||||||
@@ -874,13 +876,19 @@ def workout_rp3import_view(request,userid=0):
|
|||||||
workouts = []
|
workouts = []
|
||||||
|
|
||||||
for key,data in workouts_list.iterrows():
|
for key,data in workouts_list.iterrows():
|
||||||
i = data['id']
|
try:
|
||||||
|
i = data['id']
|
||||||
|
except KeyError:
|
||||||
|
i = 0
|
||||||
if i in knownrp3ids: # pragma: no cover
|
if i in knownrp3ids: # pragma: no cover
|
||||||
nnn = ''
|
nnn = ''
|
||||||
else:
|
else:
|
||||||
nnn = 'NEW'
|
nnn = 'NEW'
|
||||||
|
|
||||||
s = data['executed_at']
|
try:
|
||||||
|
s = data['executed_at']
|
||||||
|
except KeyError:
|
||||||
|
s = ''
|
||||||
|
|
||||||
keys = ['id','starttime','new']
|
keys = ['id','starttime','new']
|
||||||
values = [i,s,nnn]
|
values = [i,s,nnn]
|
||||||
|
|||||||
Reference in New Issue
Block a user