preventing infinite recursion
This commit is contained in:
@@ -1575,7 +1575,8 @@ def testdata(time, distance, pace, spm):
|
|||||||
# is not in DB, read from CSV file (and create DB entry)
|
# is not in DB, read from CSV file (and create DB entry)
|
||||||
|
|
||||||
|
|
||||||
def getrowdata_db(id=0, doclean=False, convertnewtons=True):
|
def getrowdata_db(id=0, doclean=False, convertnewtons=True,
|
||||||
|
checkefficiency=True):
|
||||||
data = read_df_sql(id)
|
data = read_df_sql(id)
|
||||||
data['x_right'] = data['x_right'] / 1.0e6
|
data['x_right'] = data['x_right'] / 1.0e6
|
||||||
data['deltat'] = data['time'].diff()
|
data['deltat'] = data['time'].diff()
|
||||||
@@ -1591,7 +1592,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True):
|
|||||||
row = Workout.objects.get(id=id)
|
row = Workout.objects.get(id=id)
|
||||||
|
|
||||||
|
|
||||||
if not data.empty and data['efficiency'].mean() == 0 and data['power'].mean() != 0:
|
if not data.empty and data['efficiency'].mean() == 0 and data['power'].mean() != 0 and checkefficiency == True:
|
||||||
data = add_efficiency(id=id)
|
data = add_efficiency(id=id)
|
||||||
|
|
||||||
if doclean:
|
if doclean:
|
||||||
@@ -1946,7 +1947,10 @@ def fix_newtons(id=0, limit=3000):
|
|||||||
|
|
||||||
|
|
||||||
def add_efficiency(id=0):
|
def add_efficiency(id=0):
|
||||||
rowdata, row = getrowdata_db(id=id, doclean=False, convertnewtons=False)
|
rowdata, row = getrowdata_db(id=id,
|
||||||
|
doclean=False,
|
||||||
|
convertnewtons=False,
|
||||||
|
checkefficiency=False)
|
||||||
power = rowdata['power']
|
power = rowdata['power']
|
||||||
pace = rowdata['pace'] / 1.0e3
|
pace = rowdata['pace'] / 1.0e3
|
||||||
velo = 500. / pace
|
velo = 500. / pace
|
||||||
|
|||||||
Reference in New Issue
Block a user