trimp calc fix
This commit is contained in:
@@ -2053,6 +2053,8 @@ def new_workout_from_df(r, df,
|
|||||||
dosmooth=False,
|
dosmooth=False,
|
||||||
consistencychecks=False)
|
consistencychecks=False)
|
||||||
|
|
||||||
|
job = myqueue(queuehigh,handle_calctrimp,id,csvfilename,r.ftp,r.sex,r.hrftp,r.max,r.rest)
|
||||||
|
|
||||||
return (id, message)
|
return (id, message)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -165,13 +165,17 @@ def handle_sporttracks_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
|||||||
|
|
||||||
res = update_workout_field_sql(workoutid,'uploadedtosporttracks',id,debug=debug)
|
res = update_workout_field_sql(workoutid,'uploadedtosporttracks',id,debug=debug)
|
||||||
|
|
||||||
app.task
|
@app.task
|
||||||
def handle_runkeeper_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
def handle_runkeeper_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
||||||
response = requests.post(url,headers=headers,data=data)
|
response = requests.post(url,headers=headers,data=data)
|
||||||
if response.status_code not in [200,201]:
|
if response.status_code not in [200,201]:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
t = response.json()
|
try:
|
||||||
|
t = response.json()
|
||||||
|
except JSONDecodeError:
|
||||||
|
return 0
|
||||||
|
|
||||||
uri = t['uris'][0]
|
uri = t['uris'][0]
|
||||||
regex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities/(\d+)\.json$'
|
regex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities/(\d+)\.json$'
|
||||||
m = re.compile(regex).match(uri).group(1)
|
m = re.compile(regex).match(uri).group(1)
|
||||||
@@ -180,14 +184,17 @@ def handle_runkeeper_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
|||||||
|
|
||||||
res = update_workout_field_sql(workoutid,'uploadedtorunkeeper',id,debug=debug)
|
res = update_workout_field_sql(workoutid,'uploadedtorunkeeper',id,debug=debug)
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
@app.task
|
@app.task
|
||||||
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:
|
with open(filename,'rb') as f:
|
||||||
act = client.upload_activity(f,'tcx.gz',name=name)
|
try:
|
||||||
|
act = client.upload_activity(f,'tcx.gz',name=name)
|
||||||
|
except ActivityUploadFailed:
|
||||||
|
failed = True
|
||||||
try:
|
try:
|
||||||
res = act.wait(poll_interval=5.0, timeout=60)
|
res = act.wait(poll_interval=5.0, timeout=60)
|
||||||
except ActivityUploadFailed:
|
except ActivityUploadFailed:
|
||||||
@@ -920,7 +927,10 @@ def handle_calctrimp(id,
|
|||||||
hrmax=hrmax,
|
hrmax=hrmax,
|
||||||
hrmin=hrmin,
|
hrmin=hrmin,
|
||||||
)
|
)
|
||||||
response = stub.CalcMetrics(req,timeout=60)
|
try:
|
||||||
|
response = stub.CalcMetrics(req,timeout=60)
|
||||||
|
except:
|
||||||
|
return 0
|
||||||
|
|
||||||
tss = response.tss
|
tss = response.tss
|
||||||
normp = response.normp
|
normp = response.normp
|
||||||
@@ -1876,6 +1886,8 @@ def handle_otwsetpower(self,f1, boattype, boatclass, coastalbrand, weightvalue,
|
|||||||
csvfile = f1+'.csv'
|
csvfile = f1+'.csv'
|
||||||
elif os.path.exists(f1+'.gz'):
|
elif os.path.exists(f1+'.gz'):
|
||||||
csvfile = f1+'.gz'
|
csvfile = f1+'.gz'
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
csvfile = os.path.abspath(csvfile)
|
csvfile = os.path.abspath(csvfile)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user