Private
Public Access
1
0

trimp calc fix

This commit is contained in:
Sander Roosendaal
2020-11-02 18:43:28 +01:00
parent 0761d4d203
commit c7bf448c5d
2 changed files with 19 additions and 5 deletions

View File

@@ -2053,6 +2053,8 @@ def new_workout_from_df(r, df,
dosmooth=False,
consistencychecks=False)
job = myqueue(queuehigh,handle_calctrimp,id,csvfilename,r.ftp,r.sex,r.hrftp,r.max,r.rest)
return (id, message)

View File

@@ -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)
app.task
@app.task
def handle_runkeeper_sync(workoutid,url,headers,data,debug=False,**kwargs):
response = requests.post(url,headers=headers,data=data)
if response.status_code not in [200,201]:
return 0
t = response.json()
try:
t = response.json()
except JSONDecodeError:
return 0
uri = t['uris'][0]
regex = '.*?sporttracks\.mobi\/api\/v2\/fitnessActivities/(\d+)\.json$'
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)
return 1
@app.task
def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,description,debug=False,**kwargs):
client = stravalib.Client(access_token=stravatoken)
failed = False
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:
res = act.wait(poll_interval=5.0, timeout=60)
except ActivityUploadFailed:
@@ -920,7 +927,10 @@ def handle_calctrimp(id,
hrmax=hrmax,
hrmin=hrmin,
)
response = stub.CalcMetrics(req,timeout=60)
try:
response = stub.CalcMetrics(req,timeout=60)
except:
return 0
tss = response.tss
normp = response.normp
@@ -1876,6 +1886,8 @@ def handle_otwsetpower(self,f1, boattype, boatclass, coastalbrand, weightvalue,
csvfile = f1+'.csv'
elif os.path.exists(f1+'.gz'):
csvfile = f1+'.gz'
else:
return 0
csvfile = os.path.abspath(csvfile)