diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 816eceee..10fefd9f 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -1185,7 +1185,6 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower, # fitting the data to three parameter CP model - p1 = p0 if len(thesecs)>=4: p1, success = optimize.leastsq(errfunc, p0[:], args = (thesecs,theavpower)) @@ -1271,7 +1270,7 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower, if cpdata.empty: message = 'Calculations are running in the background. Please refresh this page to see updated results' - return ['','',paulslope,paulintercept,p1,message] + return ['','',paulslope,paulintercept,p1,message,p1wc] velo = cpdata['distance']/cpdata['delta'] @@ -1338,7 +1337,7 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower, script, div = components(plot) - return [script,div,paulslope,paulintercept,p1,message] + return [script,div,paulslope,paulintercept,p1,message,p1wc] def interactive_windchart(id=0,promember=0): # check if valid ID exists (workout exists) diff --git a/rowers/metrics.py b/rowers/metrics.py index fbd6041e..6496b8ab 100644 --- a/rowers/metrics.py +++ b/rowers/metrics.py @@ -343,11 +343,14 @@ def getagegrouprecord(age,sex='male',weightcategory='hwt', ) ) - ages = df['age'] - powers = df['power'] + if not df.empty: + ages = df['age'] + powers = df['power'] - poly_coefficients = np.polyfit(ages,powers,6) + poly_coefficients = np.polyfit(ages,powers,6) - power = np.polyval(poly_coefficients,age) + power = np.polyval(poly_coefficients,age) + else: + power = 0 return power diff --git a/rowers/templates/rankings.html b/rowers/templates/rankings.html index 299dcd97..8bbcdf26 100644 --- a/rowers/templates/rankings.html +++ b/rowers/templates/rankings.html @@ -160,15 +160,21 @@ {{ the_div|safe }} -
The dashed lines are based on the Concept2 rankings for your age, gender - and weight category. World class means within 5% of World Record in terms +{% if age %} +
The dashed lines are based on the + Concept2 + rankings for your age, gender + and weight category. World class means within 5% of + + World Record in terms of power. Excellent, Good, and Fair indicate the power levels of the top 10%, 25% and 50% of the Concept2 rankings. Average is taken - as being in the top 75%, given that the Concept2 rankings probably + as being in the top 75%, which is quite good, + given that the Concept2 rankings probably represent the more competitive sub-group of all people who erg. Please note that this is a prediction for people of exactly your age, and your actual place in the Concept2 Ranking may be different.
- +{% endif %}No ranking pieces found.
' @@ -3840,6 +3850,9 @@ def rankings_view2(request,theuser=0, 'deltaform':deltaform, 'id': theuser, 'theuser':uu, + 'age':age, + 'sex':r.sex, + 'weightcategory':r.weightcategory, 'startdate':startdate, 'enddate':enddate, 'teams':get_my_teams(request.user),