video bug fix
This commit is contained in:
@@ -133,12 +133,17 @@ def get_video_data(w,groups=['basic'],mode='water'):
|
|||||||
columns = list(set(columns))
|
columns = list(set(columns))
|
||||||
df = getsmallrowdata_db(columns,ids=[w.id],
|
df = getsmallrowdata_db(columns,ids=[w.id],
|
||||||
workstrokesonly=False,doclean=False,compute=False)
|
workstrokesonly=False,doclean=False,compute=False)
|
||||||
|
|
||||||
|
|
||||||
df['time'] = (df['time']-df['time'].min())/1000.
|
df['time'] = (df['time']-df['time'].min())/1000.
|
||||||
|
|
||||||
df.sort_values(by='time',inplace=True)
|
df.sort_values(by='time',inplace=True)
|
||||||
|
|
||||||
|
|
||||||
df.set_index(pd.to_timedelta(df['time'],unit='s'),inplace=True)
|
df.set_index(pd.to_timedelta(df['time'],unit='s'),inplace=True)
|
||||||
df2 = df.resample('1s').first().fillna(method='ffill')
|
df2 = df.resample('1s').first().fillna(method='ffill')
|
||||||
|
df2['time'] = df2.index.total_seconds()
|
||||||
|
|
||||||
if 'pace' in columns:
|
if 'pace' in columns:
|
||||||
df2['pace'] = df2['pace']/1000.
|
df2['pace'] = df2['pace']/1000.
|
||||||
p = df2['pace']
|
p = df2['pace']
|
||||||
@@ -177,6 +182,8 @@ def get_video_data(w,groups=['basic'],mode='water'):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# bundle data
|
# bundle data
|
||||||
data = {
|
data = {
|
||||||
'boatspeed':boatspeed.values.tolist(),
|
'boatspeed':boatspeed.values.tolist(),
|
||||||
@@ -297,7 +304,7 @@ def get_latlon_time(id):
|
|||||||
return pd.DataFrame()
|
return pd.DataFrame()
|
||||||
|
|
||||||
df = pd.DataFrame({
|
df = pd.DataFrame({
|
||||||
'time': rowdata.df[' ElapsedTime (sec)'],
|
'time': rowdata.df['TimeStamp (sec)']-rowdata.df['TimeStamp (sec)'].min(),
|
||||||
'latitude': rowdata.df[' latitude'],
|
'latitude': rowdata.df[' latitude'],
|
||||||
'longitude': rowdata.df[' longitude']
|
'longitude': rowdata.df[' longitude']
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -185,7 +185,10 @@ def create_c2_stroke_data_db(
|
|||||||
pace = 500.*totalseconds/distance
|
pace = 500.*totalseconds/distance
|
||||||
|
|
||||||
if workouttype in ['rower','slides','dynamic']:
|
if workouttype in ['rower','slides','dynamic']:
|
||||||
velo = distance/totalseconds
|
try:
|
||||||
|
velo = distance/totalseconds
|
||||||
|
except ZeroDivisionError:
|
||||||
|
velo = 0
|
||||||
power = 2.8*velo**3
|
power = 2.8*velo**3
|
||||||
else:
|
else:
|
||||||
power = 0
|
power = 0
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
|||||||
res = act.wait(poll_interval=5.0, timeout=60)
|
res = act.wait(poll_interval=5.0, timeout=60)
|
||||||
except ActivityUploadFailed:
|
except ActivityUploadFailed:
|
||||||
failed = True
|
failed = True
|
||||||
|
except JSONDecodeError:
|
||||||
|
failed = True
|
||||||
if not failed:
|
if not failed:
|
||||||
try:
|
try:
|
||||||
act = client.update_activity(res.id,activity_type=activity_type,
|
act = client.update_activity(res.id,activity_type=activity_type,
|
||||||
@@ -730,6 +732,24 @@ def handle_calctrimp(id,
|
|||||||
normw = response.normw
|
normw = response.normw
|
||||||
hrtss = response.hrtss
|
hrtss = response.hrtss
|
||||||
|
|
||||||
|
if np.isnan(tss):
|
||||||
|
tss = 0
|
||||||
|
|
||||||
|
if np.isnan(normp):
|
||||||
|
normp = 0
|
||||||
|
|
||||||
|
if np.isnan(trimp):
|
||||||
|
trimp = 0
|
||||||
|
|
||||||
|
if np.isnan(normv):
|
||||||
|
normv = 0
|
||||||
|
|
||||||
|
if np.isnan(normw):
|
||||||
|
normw = 0
|
||||||
|
|
||||||
|
if np.isnan(hrtss):
|
||||||
|
hrtss = 0
|
||||||
|
|
||||||
|
|
||||||
query = 'UPDATE rowers_workout SET rscore = {tss}, normp = {normp}, trimp={trimp}, hrtss={hrtss}, normv={normv}, normw={normw} WHERE id={id}'.format(
|
query = 'UPDATE rowers_workout SET rscore = {tss}, normp = {normp}, trimp={trimp}, hrtss={hrtss}, normv={normv}, normw={normw} WHERE id={id}'.format(
|
||||||
tss = int(tss),
|
tss = int(tss),
|
||||||
|
|||||||
Reference in New Issue
Block a user