Merge branch 'release/v16.7.3'
This commit is contained in:
@@ -139,8 +139,11 @@ def get_polar_notifications():
|
|||||||
|
|
||||||
available_data = []
|
available_data = []
|
||||||
|
|
||||||
if response.status_code == 200:
|
try:
|
||||||
available_data = response.json()['available-user-data']
|
if response.status_code == 200:
|
||||||
|
available_data = response.json()['available-user-data']
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
return available_data
|
return available_data
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ except ImportError: # pragma: no cover
|
|||||||
JSONDecodeError = ValueError
|
JSONDecodeError = ValueError
|
||||||
|
|
||||||
from rowers.imports import *
|
from rowers.imports import *
|
||||||
|
from rowers.utils import dologging
|
||||||
|
|
||||||
webhookverification = "kudos_to_rowing"
|
webhookverification = "kudos_to_rowing"
|
||||||
webhooklink = SITE_URL+'/rowers/strava/webhooks/'
|
webhooklink = SITE_URL+'/rowers/strava/webhooks/'
|
||||||
@@ -501,6 +502,7 @@ def workout_strava_upload(user,w, quick=False,asynchron=True):
|
|||||||
tcxfile,w.name,activity_type,
|
tcxfile,w.name,activity_type,
|
||||||
w.notes
|
w.notes
|
||||||
)
|
)
|
||||||
|
dologging('strava_export_log.log','Exporting as {t}'.format(t=activity_type))
|
||||||
return "Asynchronous sync",-1
|
return "Asynchronous sync",-1
|
||||||
try:
|
try:
|
||||||
tcxfile,tcxmesg = createstravaworkoutdata(w)
|
tcxfile,tcxmesg = createstravaworkoutdata(w)
|
||||||
|
|||||||
@@ -341,6 +341,7 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
|||||||
dologging('strava_fail.log','Strava upload failed for Workout {id}'.format(id=workoutid))
|
dologging('strava_fail.log','Strava upload failed for Workout {id}'.format(id=workoutid))
|
||||||
failed = True
|
failed = True
|
||||||
except FileNotFoundError: # pragma: no cover
|
except FileNotFoundError: # pragma: no cover
|
||||||
|
dologging('strava_fail.log','Strava upload failed for Workout {id}'.format(id=workoutid))
|
||||||
failed = True
|
failed = True
|
||||||
|
|
||||||
if not failed:
|
if not failed:
|
||||||
@@ -348,21 +349,21 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
|||||||
try:
|
try:
|
||||||
act = client.update_activity(res.id,activity_type=activity_type,
|
act = client.update_activity(res.id,activity_type=activity_type,
|
||||||
description=description,device_name='Rowsandall.com')
|
description=description,device_name='Rowsandall.com')
|
||||||
dologging('stravalog.log','Updating activity {id} to {type}'.format(
|
dologging('strava_export_log.log','Updating activity {id} to {type}'.format(
|
||||||
id=workoutid,
|
id=workoutid,
|
||||||
type=activity_type
|
type=activity_type
|
||||||
))
|
))
|
||||||
except TypeError: # pragma: no cover
|
except TypeError: # pragma: no cover
|
||||||
act = client.update_activity(res.id,activity_type=activity_type,
|
act = client.update_activity(res.id,activity_type=activity_type,
|
||||||
description=description)
|
description=description)
|
||||||
dologging('stravalog.log','Updating activity {id} to {type}'.format(
|
dologging('strava_export_log.log','Updating activity {id} to {type}'.format(
|
||||||
id=workoutid,
|
id=workoutid,
|
||||||
type=activity_type
|
type=activity_type
|
||||||
))
|
))
|
||||||
except: # pragma: no cover
|
except: # pragma: no cover
|
||||||
e = sys.exc_info()[0]
|
e = sys.exc_info()[0]
|
||||||
|
|
||||||
dologging('stravalog.log','Update activity failed with error {e} for {id} to {type}'.format(
|
dologging('strava_export_log.log','Update activity failed with error {e} for {id} to {type}'.format(
|
||||||
id=workoutid,
|
id=workoutid,
|
||||||
type=activity_type,
|
type=activity_type,
|
||||||
e=e
|
e=e
|
||||||
@@ -3168,7 +3169,7 @@ def df_from_summary(data):
|
|||||||
distances = [0]
|
distances = [0]
|
||||||
try:
|
try:
|
||||||
spms = [splits[0]['stroke_rate']]
|
spms = [splits[0]['stroke_rate']]
|
||||||
except (KeyError, TypeError): # pragma: no cover
|
except (KeyError, TypeError, IndexError): # pragma: no cover
|
||||||
spms = [0]
|
spms = [0]
|
||||||
try:
|
try:
|
||||||
hrs = [splits[0]['heart_rate']['average']]
|
hrs = [splits[0]['heart_rate']['average']]
|
||||||
@@ -3298,9 +3299,13 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone
|
|||||||
|
|
||||||
strokedata = pd.DataFrame.from_dict(s.json()['data'])
|
strokedata = pd.DataFrame.from_dict(s.json()['data'])
|
||||||
|
|
||||||
res = make_cumvalues(0.1*strokedata['t'])
|
try:
|
||||||
cum_time = res[0]
|
res = make_cumvalues(0.1*strokedata['t'])
|
||||||
lapidx = res[1]
|
cum_time = res[0]
|
||||||
|
lapidx = res[1]
|
||||||
|
except KeyError:
|
||||||
|
dologging('debuglog.log','No time values in stroke data')
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
unixtime = cum_time+starttimeunix
|
unixtime = cum_time+starttimeunix
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from rowers.tasks import (
|
|||||||
from rowers.models import GraphImage
|
from rowers.models import GraphImage
|
||||||
|
|
||||||
from rowers.rower_rules import ispromember
|
from rowers.rower_rules import ispromember
|
||||||
|
from rowers.utils import dologging
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
@@ -600,6 +601,13 @@ def do_sync(w,options, quick=False):
|
|||||||
message,id = stravastuff.workout_strava_upload(
|
message,id = stravastuff.workout_strava_upload(
|
||||||
w.user.user,w,quick=quick,asynchron=True,
|
w.user.user,w,quick=quick,asynchron=True,
|
||||||
)
|
)
|
||||||
|
dologging(
|
||||||
|
'strava_export_log.log',
|
||||||
|
'exporting workout {id} as {type}'.format(
|
||||||
|
id=w.id,
|
||||||
|
type = w.workouttype,
|
||||||
|
)
|
||||||
|
)
|
||||||
except NoTokenError: # pragma: no cover
|
except NoTokenError: # pragma: no cover
|
||||||
id = 0
|
id = 0
|
||||||
message = "Please connect to Strava first"
|
message = "Please connect to Strava first"
|
||||||
|
|||||||
@@ -1537,7 +1537,7 @@ def workout_c2import_view(request,page=1,userid=0,message=""):
|
|||||||
with open('c2blocked.json','r') as c2blocked:
|
with open('c2blocked.json','r') as c2blocked:
|
||||||
jsondata = json.load(c2blocked)
|
jsondata = json.load(c2blocked)
|
||||||
parkedids = jsondata['ids']
|
parkedids = jsondata['ids']
|
||||||
except (FileNotFoundError,JSONDecodeError): # pragma: no cover
|
except: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
knownc2ids = uniqify(knownc2ids+tombstones+parkedids)
|
knownc2ids = uniqify(knownc2ids+tombstones+parkedids)
|
||||||
|
|||||||
Reference in New Issue
Block a user