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)

View File

@@ -198,12 +198,10 @@ def build_goldmedalstandards(workouts,kfitness):
# fitnesses.append(np.nan)
for w in workouts:
#ids = [w.id for w in workouts.filter(date__gte=w.date-datetime.timedelta(days=90),
# date__lte=w.date)]
ids = [w.id for w in workouts.filter(date__gte=w.date-datetime.timedelta(days=10),
ids = [w.id for w in workouts.filter(date__gte=w.date-datetime.timedelta(days=90),
date__lte=w.date)]
powerdf = df[df['workout'].isin(ids)]
indexmax = powerdf['goldmedalstandard'].idxmax()
theid = powerdf.loc[indexmax,'workout']
@@ -1880,6 +1878,7 @@ def goldmedalscorechart(user,startdate=None,enddate=None):
markerduration.append(np.nan)
duration.append(np.nan)
df = pd.DataFrame({
'markerscore':markerscore,
'markerduration':markerduration,