coverage stravastuff stuff
This commit is contained in:
@@ -1099,10 +1099,14 @@ def calculate_goldmedalstandard(rower,workout,recurrance=True):
|
||||
try:
|
||||
df = pd.read_parquet(cpfile)
|
||||
except:
|
||||
df, delta, cpvalues = setcp(workout,background=True)
|
||||
background = True
|
||||
if settings.TESTING:
|
||||
background = False
|
||||
df, delta, cpvalues = setcp(workout,background=background)
|
||||
if df.empty:
|
||||
return 0,0
|
||||
|
||||
|
||||
if df.empty and recurrance: # pragma: no cover
|
||||
df, delta, cpvalues = setcp(workout,recurrance=False,background=True)
|
||||
if df.empty:
|
||||
@@ -1110,12 +1114,15 @@ def calculate_goldmedalstandard(rower,workout,recurrance=True):
|
||||
|
||||
age = calculate_age(rower.birthdate,today=workout.date)
|
||||
|
||||
|
||||
|
||||
agerecords = CalcAgePerformance.objects.filter(
|
||||
age=age,
|
||||
sex=rower.sex,
|
||||
weightcategory = rower.weightcategory
|
||||
)
|
||||
|
||||
|
||||
wcdurations = []
|
||||
wcpower = []
|
||||
getrecords = False
|
||||
@@ -1214,17 +1221,17 @@ 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])
|
||||
|
||||
try:
|
||||
if strokesdf['power'].std()==0:
|
||||
return pd.DataFrame(),pd.Series(),pd.Series()
|
||||
except KeyError:
|
||||
return pd.DataFrame(),pd.Series(),pd.Series()
|
||||
|
||||
if background:
|
||||
if background: # pragma: no cover
|
||||
job = myqueue(queuelow,handle_setcp,strokesdf,filename,workout.id)
|
||||
return pd.DataFrame({'delta':[],'cp':[]}),pd.Series(),pd.Series()
|
||||
|
||||
|
||||
if not strokesdf.empty:
|
||||
totaltime = strokesdf['time'].max()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user