Private
Public Access
1
0

video bug fix

This commit is contained in:
Sander Roosendaal
2020-04-19 16:16:56 +02:00
parent c95aa78009
commit 043b2eeba8
3 changed files with 32 additions and 2 deletions

View File

@@ -133,12 +133,17 @@ def get_video_data(w,groups=['basic'],mode='water'):
columns = list(set(columns))
df = getsmallrowdata_db(columns,ids=[w.id],
workstrokesonly=False,doclean=False,compute=False)
df['time'] = (df['time']-df['time'].min())/1000.
df.sort_values(by='time',inplace=True)
df.set_index(pd.to_timedelta(df['time'],unit='s'),inplace=True)
df2 = df.resample('1s').first().fillna(method='ffill')
df2['time'] = df2.index.total_seconds()
if 'pace' in columns:
df2['pace'] = df2['pace']/1000.
p = df2['pace']
@@ -177,6 +182,8 @@ def get_video_data(w,groups=['basic'],mode='water'):
# bundle data
data = {
'boatspeed':boatspeed.values.tolist(),
@@ -297,7 +304,7 @@ def get_latlon_time(id):
return pd.DataFrame()
df = pd.DataFrame({
'time': rowdata.df[' ElapsedTime (sec)'],
'time': rowdata.df['TimeStamp (sec)']-rowdata.df['TimeStamp (sec)'].min(),
'latitude': rowdata.df[' latitude'],
'longitude': rowdata.df[' longitude']
})

View File

@@ -185,7 +185,10 @@ def create_c2_stroke_data_db(
pace = 500.*totalseconds/distance
if workouttype in ['rower','slides','dynamic']:
velo = distance/totalseconds
try:
velo = distance/totalseconds
except ZeroDivisionError:
velo = 0
power = 2.8*velo**3
else:
power = 0

View File

@@ -179,6 +179,8 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
res = act.wait(poll_interval=5.0, timeout=60)
except ActivityUploadFailed:
failed = True
except JSONDecodeError:
failed = True
if not failed:
try:
act = client.update_activity(res.id,activity_type=activity_type,
@@ -730,6 +732,24 @@ def handle_calctrimp(id,
normw = response.normw
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(
tss = int(tss),