Private
Public Access
1
0

passing tests - saving goldmedal score

This commit is contained in:
Sander Roosendaal
2020-12-05 13:31:02 +01:00
parent 473198b88b
commit 1dd0c0cff9
2 changed files with 8 additions and 2 deletions

View File

@@ -1083,7 +1083,7 @@ def fitscore(rower,workout):
indexmax = scores.idxmax()
delta = df.loc[indexmax,'delta']
maxvalue = scores.max()
except ValueError:
except (ValueError,TypeError):
indexmax = 0
delta = 0
maxvalue = 0
@@ -1150,6 +1150,9 @@ def setcp(workout,background=False):
'id':workout.id,
})
df.to_parquet(filename,engine='fastparquet',compression='GZIP')
goldmedalstandard, goldmedalduration = fitscore(workout.user,workout)
workout.goldmedalstandard = goldmedalstandard
workout.save()
return df,delta,cpvalues
return pd.DataFrame({'delta':[],'cp':[]}),pd.Series(),pd.Series()

View File

@@ -327,7 +327,10 @@ def calculate_age(born,today=None):
if not today:
today = date.today()
if born:
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
try:
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
except AttributeError:
return None
else:
return None