Private
Public Access
1
0

strava working

This commit is contained in:
Sander Roosendaal
2018-11-14 20:52:53 +01:00
parent 7d06649cae
commit 1f0a5f5ec9
4 changed files with 72 additions and 12 deletions

View File

@@ -18,7 +18,7 @@ from stravalib.exc import ActivityUploadFailed,TimeoutExceeded
from iso8601 import ParseError
from utils import myqueue
import mytypes
import gzip
from rowsandall_app.settings import (
@@ -163,7 +163,7 @@ def create_async_workout(alldata,user,stravaid,debug=False):
distance = data['distance']
stravaid = data['id']
try:
workouttype = data['type']
workouttype = mytypes.stravamappinginv[data['type']]
except:
workouttype = 'rower'
@@ -444,14 +444,15 @@ def add_workout_from_data(user,importid,data,strokedata,
source='strava',splitdata=None,
workoutsource='strava'):
try:
workouttype = data['type']
workouttype = mytypes.stravamappinginv[data['type']]
except KeyError:
workouttype = 'rower'
if workouttype.lower() == 'rowing':
workouttype = 'rower'
if 'summary_polyline' in data['map']:
workouttype = 'water'
if 'summary_polyline' in data['map'] and workouttype=='rower':
workouttype = 'water'
if workouttype not in [x[0] for x in Workout.workouttypes]:
workouttype = 'other'