Private
Public Access
1
0

small speed gain

This commit is contained in:
Sander Roosendaal
2021-01-04 19:45:58 +01:00
parent 92ebe1f319
commit c3f72b2ebd
2 changed files with 8 additions and 6 deletions

View File

@@ -1111,6 +1111,8 @@ def calculate_goldmedalstandard(rower,workout,recurrance=True):
if df.empty and recurrance:
df, delta, cpvalues = setcp(workout,recurrance=False)
if df.empty:
return 0,0
age = calculate_age(rower.birthdate,today=workout.date)
@@ -1209,9 +1211,11 @@ def setcp(workout,background=False,recurrance=True):
filename = 'media/cpdata_{id}.parquet.gz'.format(id=workout.id)
strokesdf = getsmallrowdata_db(['power','workoutid','time'],ids = [workout.id])
if strokesdf['power'].std()==0:
return pd.DataFrame(),pd.Series(),pd.Series()
if background:
job = myqueue(queuelow,handle_setcp,strokesdf,filename,workout.id)
return job.id
return pd.DataFrame({'delta':[],'cp':[]}),pd.Series(),pd.Series()
if not strokesdf.empty:
@@ -1492,7 +1496,6 @@ def checkduplicates(r,workoutdate,workoutstartdatetime,workoutenddatetime):
t = ww.duration
delta = datetime.timedelta(hours=t.hour, minutes=t.minute, seconds=t.second)
enddatetime = ww.startdatetime+delta
print(enddatetime,workoutstartdatetime)
if enddatetime > workoutstartdatetime:
ws2.append(ww)