strava done
This commit is contained in:
@@ -195,7 +195,9 @@ def create_async_workout(alldata,user,stravaid,debug=False):
|
||||
|
||||
return 1
|
||||
|
||||
from utils import get_strava_stream
|
||||
from utils import get_strava_stream
|
||||
|
||||
|
||||
|
||||
# Get a Strava workout summary data and stroke data by ID
|
||||
def get_workout(user,stravaid):
|
||||
@@ -225,12 +227,15 @@ def get_workout(user,stravaid):
|
||||
distancejson = get_strava_stream(r,'distance',stravaid)
|
||||
latlongjson = get_strava_stream(r,'latlng',stravaid)
|
||||
|
||||
|
||||
|
||||
try:
|
||||
t = np.array(timejson.json()[0]['data'])
|
||||
nr_rows = len(t)
|
||||
d = np.array(distancejson.json()[1]['data'])
|
||||
if nr_rows == 0:
|
||||
return (0,"Error: Time data had zero length")
|
||||
|
||||
except IndexError:
|
||||
d = 0*t
|
||||
# return (0,"Error: No Distance information in the Strava data")
|
||||
@@ -277,6 +282,7 @@ def get_workout(user,stravaid):
|
||||
strokelength = velo*60./(spm)
|
||||
strokelength[np.isinf(strokelength)] = 0.0
|
||||
|
||||
|
||||
pace = 500./(1.0*velo2)
|
||||
pace[np.isinf(pace)] = 0.0
|
||||
|
||||
@@ -290,6 +296,7 @@ def get_workout(user,stravaid):
|
||||
'strokelength':strokelength,
|
||||
})
|
||||
|
||||
|
||||
# startdatetime = datetime.datetime.strptime(startdatetime,"%Y-%m-%d-%H:%M:%S")
|
||||
|
||||
return [workoutsummary,df]
|
||||
@@ -487,6 +494,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
|
||||
|
||||
df.sort_values(by='TimeStamp (sec)',ascending=True)
|
||||
|
||||
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
|
||||
@@ -509,7 +517,6 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
dosummary=True
|
||||
)
|
||||
|
||||
|
||||
|
||||
return id,message
|
||||
|
||||
|
||||
Reference in New Issue
Block a user