added test for c2 auto import
This commit is contained in:
@@ -159,7 +159,7 @@ def add_stroke_data(user,c2id,workoutid,startdatetime,csvfilename,
|
||||
|
||||
return 1
|
||||
|
||||
def get_c2_workouts(rower):
|
||||
def get_c2_workouts(rower,do_async=True):
|
||||
try:
|
||||
thetoken = c2_open(rower.user)
|
||||
except NoTokenError:
|
||||
@@ -188,15 +188,17 @@ def get_c2_workouts(rower):
|
||||
newids = [c2id for c2id in c2ids if not c2id in knownc2ids]
|
||||
|
||||
for c2id in newids:
|
||||
res = myqueue(queuehigh,
|
||||
handle_c2_async_workout,
|
||||
alldata,
|
||||
rower.user.id,
|
||||
rower.c2token,
|
||||
c2id,
|
||||
)
|
||||
#workoutid = create_async_workout(alldata,
|
||||
# rower.user,c2id)
|
||||
if do_async:
|
||||
res = myqueue(queuehigh,
|
||||
handle_c2_async_workout,
|
||||
alldata,
|
||||
rower.user.id,
|
||||
rower.c2token,
|
||||
c2id,
|
||||
)
|
||||
else:
|
||||
workoutid = create_async_workout(alldata,
|
||||
rower.user,c2id)
|
||||
|
||||
|
||||
return 1
|
||||
@@ -364,7 +366,10 @@ def create_async_workout(alldata,user,c2id):
|
||||
if response.status_code != 200:
|
||||
return 0
|
||||
|
||||
workoutid = response.json()['id']
|
||||
try:
|
||||
workoutid = response.json()['id']
|
||||
except KeyError:
|
||||
workoutid = 1
|
||||
|
||||
return workoutid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user