Private
Public Access
1
0

Merge branch 'develop' into feature/analysis2

This commit is contained in:
Sander Roosendaal
2019-04-29 16:20:47 +02:00
6 changed files with 12 additions and 15 deletions

View File

@@ -2102,6 +2102,7 @@ def add_efficiency(id=0):
def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True, def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True,
empower=True, inboard=0.88, forceunit='lbs'): empower=True, inboard=0.88, forceunit='lbs'):
if rowdatadf.empty: if rowdatadf.empty:
return 0 return 0

View File

@@ -1233,20 +1233,20 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
data['ergpace'] = ergpace*1e3 data['ergpace'] = ergpace*1.e3
data['nowindpace'] = nowindpace*1e3 data['nowindpace'] = nowindpace*1.e3
data['equivergpower'] = equivergpower data['equivergpower'] = equivergpower
data['fergpace'] = nicepaceformat(ergpace2) data['fergpace'] = nicepaceformat(ergpace2)
data['fnowindpace'] = nicepaceformat(nowindpace2) data['fnowindpace'] = nicepaceformat(nowindpace2)
data['efficiency'] = efficiency data['efficiency'] = efficiency
data = data.replace([-np.inf,np.inf],np.nan) data = data.replace([-np.inf,np.inf],np.nan)
data = data.fillna(method='ffill') data = data.fillna(method='ffill')
data.dropna(axis=0,inplace=True,how='all') data.dropna(axis=0,inplace=True,how='all')
data.dropna(axis=1,inplace=True,how='any') data.dropna(axis=1,inplace=True,how='any')
# write data if id given # write data if id given
if id != 0: if id != 0:
data['workoutid'] = id data['workoutid'] = id
@@ -1257,14 +1257,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
engine = create_engine(database_url, echo=False) engine = create_engine(database_url, echo=False)
with engine.connect() as conn, conn.begin(): with engine.connect() as conn, conn.begin():
try: data.to_sql('strokedata',engine,if_exists='append',index=False)
data.to_sql('strokedata',engine,if_exists='append',index=False)
except:
data.drop(columns=['rhythm'],inplace=True)
try:
data.to_sql('strokedata',engine,if_exists='append',index=False)
except:
pass
conn.close() conn.close()
engine.dispose() engine.dispose()

View File

@@ -4823,6 +4823,9 @@ def interactive_otw_advanced_pace_chart(id=0,promember=0):
) )
plot = Figure(x_axis_type="datetime",y_axis_type="datetime", plot = Figure(x_axis_type="datetime",y_axis_type="datetime",
tools=TOOLS, tools=TOOLS,
plot_width=920, plot_width=920,

View File

@@ -1455,7 +1455,7 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
except KeyError: except KeyError:
pass pass
df = getsmallrowdata_db( df = getsmallrowdata_db(
['power', 'workoutid', 'time'], ids=[encoder.decode_hex(workoutid)], ['power', 'workoutid', 'time'], ids=[workoutid],
debug=debug) debug=debug)
thesecs = totaltime thesecs = totaltime
maxt = 1.05 * thesecs maxt = 1.05 * thesecs
@@ -1468,7 +1468,7 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
delta, cpvalues, ps[0], ps[1], ps[2], ps[3], ratio) delta, cpvalues, ps[0], ps[1], ps[2], ps[3], ratio)
if res: if res:
handle_sendemail_breakthrough( handle_sendemail_breakthrough(
encoder.decode_hex(workoutid), email, workoutid, email,
first_name, first_name,
last_name, btvalues=btvalues.to_json()) last_name, btvalues=btvalues.to_json())
@@ -1481,7 +1481,7 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
d = { d = {
'first_name':first_name, 'first_name':first_name,
'siteurl':siteurl, 'siteurl':siteurl,
'workoutid':workoutid, 'workoutid':encoder.encode_hex(workoutid),
} }
res = send_template_email(from_email,[fullemail], res = send_template_email(from_email,[fullemail],

Binary file not shown.

View File

@@ -2190,7 +2190,7 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
job = myqueue(queuelow, job = myqueue(queuelow,
handle_otwsetpower,f1,boattype, handle_otwsetpower,f1,boattype,
weightvalue, weightvalue,
first_name,last_name,emailaddress,id, first_name,last_name,emailaddress,encoder.decode_hex(id),
ps=[r.p0,r.p1,r.p2,r.p3], ps=[r.p0,r.p1,r.p2,r.p3],
ratio=r.cpratio, ratio=r.cpratio,
quick_calc = quick_calc, quick_calc = quick_calc,