Private
Public Access
1
0

fixed nan values in updatefitnessmetric

This commit is contained in:
Sander Roosendaal
2018-03-19 10:23:39 +01:00
parent 240210d43e
commit 073533f1a9
2 changed files with 9 additions and 10 deletions

View File

@@ -677,14 +677,11 @@ def getsmallrowdata_db(columns,ids=[],debug=False):
def fitnessmetric_to_sql(m,table='powertimefitnessmetric',debug=False,
doclean=False):
# test if nan among values
if np.nan in m.values() or np.inf in m.values():
for key in m.keys():
if np.isnan([m[key]]):
m[key] = -1
if m[key] == np.inf:
m[key] = -1
if -m[key] == np.inf:
m[key] = -1
for key in m.keys():
if str(m[key]) == 'nan':
m[key] = -1
if 'inf' in str(m[key]):
m[key] = -1
if debug:
engine = create_engine(database_url_debug, echo=False)
@@ -702,9 +699,10 @@ def fitnessmetric_to_sql(m,table='powertimefitnessmetric',debug=False,
values = tuple(m[key] for key in m.keys())
with engine.connect() as conn, conn.begin():
result = conn.execute(query,values)
if doclean:
result2 = conn.execute(query2)
result = conn.execute(query,values)
conn.close()
engine.dispose()

View File

@@ -13031,7 +13031,8 @@ def plannedsession_view(request,id=0,rowerid=0,
{
'psdict': psdict,
'attrs':[
'name','startdate','enddate','sessiontype',
'name','startdate','enddate','preferreddate',
'sessiontype',
'sessionmode','criterium',
'sessionvalue','sessionunit','comment',
],