Private
Public Access
1
0

small bug fixes

This commit is contained in:
Sander Roosendaal
2018-06-25 10:22:39 +02:00
parent ddab8080fb
commit a2c0048ba1
2 changed files with 11 additions and 3 deletions

View File

@@ -38,6 +38,11 @@ from stravalib.exc import ActivityUploadFailed,TimeoutExceeded
from rowsandall_app.settings import C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET, STRAVA_CLIENT_ID, STRAVA_REDIRECT_URI, STRAVA_CLIENT_SECRET
try:
from json.decoder import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
# Exponentially weighted moving average
# Used for data smoothing of the jagged data obtained by Strava
# See bitbucket issue 72
@@ -106,7 +111,7 @@ def get_token(code):
try:
token_json = response.json()
thetoken = token_json['access_token']
except KeyError:
except (KeyError,JSONDecodeError):
thetoken = 0
return [thetoken]

View File

@@ -1409,8 +1409,11 @@ def add_workout_from_runkeeperdata(user,importid,data):
unixtime = cum_time+starttimeunix
unixtime[0] = starttimeunix
try:
unixtime[0] = starttimeunix
except IndexError:
return (0,'No data to import')
df['TimeStamp (sec)'] = unixtime