polarized marker workouts
This commit is contained in:
@@ -415,7 +415,7 @@ def resample(id, r, parent, overwrite='copy'):
|
|||||||
def calculate_goldmedalstandard(rower, workout, recurrance=True):
|
def calculate_goldmedalstandard(rower, workout, recurrance=True):
|
||||||
cpfile = 'media/cpdata_{id}.parquet.gz'.format(id=workout.id)
|
cpfile = 'media/cpdata_{id}.parquet.gz'.format(id=workout.id)
|
||||||
try:
|
try:
|
||||||
df = pd.read_parquet(cpfile)
|
df = pl.read_parquet(cpfile)
|
||||||
except:
|
except:
|
||||||
background = True
|
background = True
|
||||||
if settings.TESTING:
|
if settings.TESTING:
|
||||||
@@ -423,11 +423,13 @@ def calculate_goldmedalstandard(rower, workout, recurrance=True):
|
|||||||
df, delta, cpvalues = setcp(workout, background=background)
|
df, delta, cpvalues = setcp(workout, background=background)
|
||||||
if df.empty:
|
if df.empty:
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
df = pl.from_pandas(df)
|
||||||
|
|
||||||
if df.empty and recurrance: # pragma: no cover
|
if df.is_empty() and recurrance: # pragma: no cover
|
||||||
df, delta, cpvalues = setcp(workout, recurrance=False, background=True)
|
df, delta, cpvalues = setcp(workout, recurrance=False, background=True)
|
||||||
if df.empty:
|
if df.empty:
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
df = pl.from_pandas(df)
|
||||||
|
|
||||||
age = calculate_age(rower.birthdate, today=workout.date)
|
age = calculate_age(rower.birthdate, today=workout.date)
|
||||||
|
|
||||||
@@ -490,9 +492,10 @@ def calculate_goldmedalstandard(rower, workout, recurrance=True):
|
|||||||
scores = 100.*powers/wcpowers
|
scores = 100.*powers/wcpowers
|
||||||
|
|
||||||
try:
|
try:
|
||||||
indexmax = scores.idxmax()
|
df = pl.DataFrame({'times': times, 'scores': scores})
|
||||||
delta = int(df.loc[indexmax, 'delta'])
|
df = df.filter(pl.col("scores") == pl.col("scores").max())
|
||||||
maxvalue = scores.max()
|
delta = df[0, "times"]
|
||||||
|
maxvalue = df[0, "scores"]
|
||||||
except (ValueError, TypeError, KeyError): # pragma: no cover
|
except (ValueError, TypeError, KeyError): # pragma: no cover
|
||||||
indexmax = 0
|
indexmax = 0
|
||||||
delta = 0
|
delta = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user