Private
Public Access
1
0

fixed background jobs in tests

This commit is contained in:
Sander Roosendaal
2019-02-17 10:58:51 +01:00
parent c4523ea03e
commit 158a1e7956
3 changed files with 27 additions and 24 deletions

View File

@@ -692,10 +692,12 @@ def runcpupdate(
theids = [w.id for w in theworkouts]
if settings.DEBUG:
job = handle_updatecp.delay(rower.id,theids,debug=True,table=table)
else:
job = queue.enqueue(handle_updatecp,rower.id,theids,table=table)
job = myqueue(
queue,
handle_updatecp,
rower.id,
theids,
table=table)
return job
@@ -704,10 +706,11 @@ def fetchcperg(rower,theworkouts):
thefilenames = [w.csvfilename for w in theworkouts]
cpdf = getcpdata_sql(rower.id,table='ergcpdata')
if settings.DEBUG:
res = handle_updateergcp.delay(rower.id,thefilenames,debug=True)
else:
res = queue.enqueue(handle_updateergcp,rower.id,thefilenames)
job = myqueue(
queue,
handle_updateergcp,
rower.id,
thefilenames)
return cpdf
@@ -738,10 +741,12 @@ def fetchcp(rower,theworkouts,table='cpdata'):
if not cpdf.empty:
return cpdf['delta'],cpdf['cp'],avgpower2
else:
if settings.DEBUG:
res = handle_updatecp.delay(rower.id,theids,debug=True,table=table)
else:
res = queue.enqueue(handle_updatecp,rower.id,theids,table=table)
job = myqueue(queue,
handle_updatecp,
rower.id,
theids,
table=table)
return [],[],avgpower2
@@ -1315,13 +1320,11 @@ def new_workout_from_file(r, f2,
message = "We couldn't recognize the file type"
f4 = f2[:-5]+'a'+f2[-5:]
copyfile(f2,f4)
if settings.DEBUG:
res = handle_sendemail_unrecognized.delay(f4,
r.user.email)
else:
res = queuehigh.enqueue(handle_sendemail_unrecognized,
f4, r.user.email)
job = myqueue(queuehigh,
handle_sendemail_unrecognized,
f4,
r.user.email)
return (0, message, f2)
# handle non-Painsled by converting it to painsled compatible CSV