fixing bugs in asynchronous tasks
This commit is contained in:
@@ -715,6 +715,8 @@ def getsmallrowdata_db(columns,ids=[],debug=False):
|
||||
data = []
|
||||
columns = [c for c in columns if c != 'None']
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
if len(ids)>1:
|
||||
for id, f in zip(ids,csvfilenames):
|
||||
try:
|
||||
@@ -728,11 +730,13 @@ def getsmallrowdata_db(columns,ids=[],debug=False):
|
||||
df = pd.concat(data,axis=0)
|
||||
except ValueError:
|
||||
df = pd.DataFrame()
|
||||
else:
|
||||
elif len(ids)==1:
|
||||
try:
|
||||
df = pd.read_parquet(csvfilenames[0],columns=columns,engine='pyarrow')
|
||||
except (OSError,IndexError):
|
||||
df = pd.DataFrame()
|
||||
else:
|
||||
df = pd.DataFrame()
|
||||
|
||||
|
||||
return df
|
||||
|
||||
@@ -1754,15 +1754,15 @@ def handle_updatefitnessmetric(user_id,mode,workoutids,debug=False,
|
||||
def handle_updatecp(rower_id,workoutids,debug=False,table='cpdata',**kwargs):
|
||||
columns = ['power','workoutid','time']
|
||||
df = getsmallrowdata_db(columns,ids=workoutids,debug=debug)
|
||||
dfgrouped = df.groupby(['workoutid'])
|
||||
|
||||
if not df.empty:
|
||||
maxt = 1.05*df['time'].max()/1000.
|
||||
else:
|
||||
maxt = 1000.
|
||||
if df.empty:
|
||||
return 0
|
||||
|
||||
maxt = 1.05*df['time'].max()/1000.
|
||||
|
||||
logarr = datautils.getlogarr(maxt)
|
||||
|
||||
dfgrouped = df.groupby(['workoutid'])
|
||||
|
||||
delta,cpvalue,avgpower = datautils.getcp(dfgrouped,logarr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user