passing tests
This commit is contained in:
@@ -1165,7 +1165,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True,
|
|||||||
|
|
||||||
if data.empty:
|
if data.empty:
|
||||||
rowdata, row = getrowdata(id=id)
|
rowdata, row = getrowdata(id=id)
|
||||||
if not rowdata.empty:
|
if not rowdata.empty: # pragma: no cover
|
||||||
data = dataprep(rowdata.df, id=id, bands=True,
|
data = dataprep(rowdata.df, id=id, bands=True,
|
||||||
barchart=True, otwpower=True)
|
barchart=True, otwpower=True)
|
||||||
else:
|
else:
|
||||||
@@ -1511,7 +1511,7 @@ def add_efficiency(id=0): # pragma: no cover
|
|||||||
|
|
||||||
|
|
||||||
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', debug=False):
|
||||||
|
|
||||||
if rowdatadf.empty:
|
if rowdatadf.empty:
|
||||||
return 0
|
return 0
|
||||||
@@ -1803,18 +1803,14 @@ def delete_agegroup_db(age, sex, weightcategory, debug=False):
|
|||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
engine = create_engine(database_url, echo=False)
|
engine = create_engine(database_url, echo=False)
|
||||||
|
|
||||||
query = sa.text('DELETE from {table} WHERE age={age} and weightcategory = {weightcategory} and sex={sex};'.format(
|
query = sa.text("DELETE from {table} WHERE age='{age}' and weightcategory='{weightcategory}' and sex='{sex}';".format(
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age,
|
age=age,
|
||||||
weightcategory=weightcategory,
|
weightcategory=weightcategory,
|
||||||
table='calcagegrouprecords'
|
table='calcagegrouprecords'
|
||||||
))
|
))
|
||||||
with engine.connect() as conn, conn.begin():
|
with engine.connect() as conn, conn.begin():
|
||||||
try:
|
|
||||||
_ = conn.execute(query)
|
_ = conn.execute(query)
|
||||||
except Exception as e: # pragma: no cover
|
|
||||||
print(Exception, e)
|
|
||||||
print("Database locked")
|
|
||||||
conn.close()
|
conn.close()
|
||||||
engine.dispose()
|
engine.dispose()
|
||||||
|
|
||||||
@@ -1934,10 +1930,8 @@ def add_c2_stroke_data_db(strokedata, workoutid, starttimeunix, csvfilename,
|
|||||||
res = df.to_csv(csvfilename, index_label='index',
|
res = df.to_csv(csvfilename, index_label='index',
|
||||||
compression='gzip')
|
compression='gzip')
|
||||||
|
|
||||||
try:
|
|
||||||
data = dataprep(df, id=workoutid, bands=False, debug=debug)
|
data = dataprep(df, id=workoutid, bands=False, debug=debug)
|
||||||
except: # pragma: no cover
|
|
||||||
return 0
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ CFG = yamjam()['rowsandallapp']
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE",CFG['settings_name'])
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE",CFG['settings_name'])
|
||||||
except KeyError:
|
except KeyError: # pragma: no cover
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE","rowsandall_app.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE","rowsandall_app.settings")
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|||||||
Reference in New Issue
Block a user