diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py index 95615913..e4915eea 100644 --- a/rowers/views/analysisviews.py +++ b/rowers/views/analysisviews.py @@ -521,11 +521,11 @@ def cpdata(workouts, options): ids = [w.id for w in workouts] - delta, cpvalue, avgpower,workouts = dataprep.fetchcp_new(r,workouts) + delta, cpvalue, avgpower,workoutnames = dataprep.fetchcp_new(r,workouts) powerdf = pd.DataFrame({ 'Delta':delta, 'CP':cpvalue, - 'workout':workouts, + 'workout':workoutnames, }) @@ -540,8 +540,15 @@ def cpdata(workouts, options): rowername = r.user.first_name+" "+r.user.last_name if len(powerdf) !=0 : + datefirst = pd.Series(w.date for w in workouts).min() + datelast = pd.Series(w.date for w in workouts).max() + title = 'CP chart for {name}, from {d1} to {d2}'.format( + name = rowername, + d1 = datefirst, + d2 = datelast, + ) res = interactive_otwcpchart(powerdf,promember=True,rowername=rowername,r=r, - cpfit=cpfit) + cpfit=cpfit,title=title) script = res[0] div = res[1] p1 = res[2]