passing tests - saving goldmedal score
This commit is contained in:
@@ -1083,7 +1083,7 @@ def fitscore(rower,workout):
|
|||||||
indexmax = scores.idxmax()
|
indexmax = scores.idxmax()
|
||||||
delta = df.loc[indexmax,'delta']
|
delta = df.loc[indexmax,'delta']
|
||||||
maxvalue = scores.max()
|
maxvalue = scores.max()
|
||||||
except ValueError:
|
except (ValueError,TypeError):
|
||||||
indexmax = 0
|
indexmax = 0
|
||||||
delta = 0
|
delta = 0
|
||||||
maxvalue = 0
|
maxvalue = 0
|
||||||
@@ -1150,6 +1150,9 @@ def setcp(workout,background=False):
|
|||||||
'id':workout.id,
|
'id':workout.id,
|
||||||
})
|
})
|
||||||
df.to_parquet(filename,engine='fastparquet',compression='GZIP')
|
df.to_parquet(filename,engine='fastparquet',compression='GZIP')
|
||||||
|
goldmedalstandard, goldmedalduration = fitscore(workout.user,workout)
|
||||||
|
workout.goldmedalstandard = goldmedalstandard
|
||||||
|
workout.save()
|
||||||
return df,delta,cpvalues
|
return df,delta,cpvalues
|
||||||
|
|
||||||
return pd.DataFrame({'delta':[],'cp':[]}),pd.Series(),pd.Series()
|
return pd.DataFrame({'delta':[],'cp':[]}),pd.Series(),pd.Series()
|
||||||
|
|||||||
@@ -327,7 +327,10 @@ def calculate_age(born,today=None):
|
|||||||
if not today:
|
if not today:
|
||||||
today = date.today()
|
today = date.today()
|
||||||
if born:
|
if born:
|
||||||
|
try:
|
||||||
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
|
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
|
||||||
|
except AttributeError:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user