Private
Public Access
1
0

Merge tag 'v1.54' into develop

bug fix strava access denied response
This commit is contained in:
Sander Roosendaal
2017-03-09 15:33:50 +01:00
4 changed files with 29 additions and 7 deletions

View File

@@ -1 +0,0 @@
E408191@CZ27LT9RCGN72.15972:1488820163

View File

@@ -1665,8 +1665,15 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
xaxmax = datadf['distance'].max()
xaxmin = datadf['distance'].min()
yaxmin = yaxminima[yparam]
yaxmax = yaxmaxima[yparam]
if yparam == 'distance':
yaxmin = datadf['distance'].min()
yaxmax = datadf['distance'].max()
elif yparam == 'cumdist':
yaxmin = datadf['cumdist'].min()
yaxmax = datadf['cumdist'].max()
else:
yaxmin = yaxminima[yparam]
yaxmax = yaxmaxima[yparam]
x_axis_type = 'linear'
y_axis_type = 'linear'

View File

@@ -163,9 +163,12 @@ def get_strava_workout(user,stravaid):
url = "https://www.strava.com/api/v3/activities/"+str(stravaid)+"/streams/latlng?resolution="+fetchresolution
latlongjson = requests.get(url,headers=headers)
t = np.array(timejson.json()[0]['data'])
d = np.array(distancejson.json()[0]['data'])
nr_rows = len(t)
try:
t = np.array(timejson.json()[0]['data'])
d = np.array(distancejson.json()[0]['data'])
nr_rows = len(t)
except KeyError:
return (0,"something went wrong with the Strava import")
try:
spm = np.array( spmjson.json()[1]['data'])

View File

@@ -1163,7 +1163,16 @@ def rower_process_twittercallback(request):
# Process Strava Callback
@login_required()
def rower_process_stravacallback(request):
code = request.GET['code']
try:
code = request.GET['code']
except MultiValueDictKeyError:
try:
message = request.GET['error']
except MultiValueDictKeyError:
message = "access error"
return imports_view(request,message=message)
res = stravastuff.get_token(code)
if res[0]:
@@ -4452,6 +4461,10 @@ def workout_c2import_view(request,message=""):
# Import a workout from Strava
@login_required()
def workout_getstravaworkout_view(request,stravaid):
res = stravastuff.get_strava_workout(request.user,stravaid)
if not res[0]:
message = "Something went wrong in Strava import"
return imports_view(request,message=message)
strokedata = res[1]
data = res[0]