adding strava logging to analyze errors
This commit is contained in:
@@ -11,6 +11,7 @@ import gzip
|
||||
import shutil
|
||||
import numpy as np
|
||||
import re
|
||||
import sys
|
||||
|
||||
from scipy import optimize
|
||||
from scipy.signal import savgol_filter
|
||||
@@ -188,6 +189,15 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
||||
except TypeError:
|
||||
act = client.update_activity(res.id,activity_type=activity_type,
|
||||
description=description)
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
t = time.localtime()
|
||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||
with open('stravalog.log','a') as f:
|
||||
f.write('\n')
|
||||
f.write(timestamp)
|
||||
f.write(str(e))
|
||||
|
||||
result = update_workout_field_sql(workoutid,'uploadedtostrava',res.id,debug=debug)
|
||||
try:
|
||||
os.remove(filename)
|
||||
@@ -750,6 +760,24 @@ def handle_calctrimp(id,
|
||||
if np.isnan(hrtss):
|
||||
hrtss = 0
|
||||
|
||||
if tss > 1000:
|
||||
tss = 0
|
||||
|
||||
if trimp > 1000:
|
||||
trimp = 0
|
||||
|
||||
if normp > 2000:
|
||||
normp = 0
|
||||
|
||||
if normv > 2000:
|
||||
normv = 0
|
||||
|
||||
if normw > 10000:
|
||||
normw = 0
|
||||
|
||||
if hrtss > 1000:
|
||||
hrtss = 0
|
||||
|
||||
|
||||
query = 'UPDATE rowers_workout SET rscore = {tss}, normp = {normp}, trimp={trimp}, hrtss={hrtss}, normv={normv}, normw={normw} WHERE id={id}'.format(
|
||||
tss = int(tss),
|
||||
|
||||
@@ -25,6 +25,7 @@ import yamllint
|
||||
from subprocess import call
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
|
||||
from verbalexpressions import VerEx
|
||||
|
||||
@@ -551,6 +552,15 @@ def do_sync(w,options, quick=False):
|
||||
except NoTokenError:
|
||||
id = 0
|
||||
message = "Please connect to Strava first"
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
t = time.localtime()
|
||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||
with open('stravalog.log','a') as f:
|
||||
f.write('\n')
|
||||
f.write(timestamp)
|
||||
f.write(str(e))
|
||||
|
||||
|
||||
|
||||
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and ispromember(w.user.user)):
|
||||
|
||||
Reference in New Issue
Block a user