diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 25eaf03e..4c63f080 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -144,6 +144,7 @@ def all_goldmedalstandards(workouts,startdate,enddate): dates = [] testpowers = [] testduration = [] + ids = [] for w in workouts: goldmedalstandard, goldmedalseconds = dataprep.workout_goldmedalstandard(w) @@ -151,8 +152,9 @@ def all_goldmedalstandards(workouts,startdate,enddate): dates.append(arrow.get(w.date).datetime) testpowers.append(goldmedalstandard) testduration.append(goldmedalseconds) + ids.append(w.id) - return dates,testpowers,testduration + return dates,testpowers,testduration,ids def build_goldmedalstandards(workouts,kfitness): dates = [] @@ -1831,8 +1833,8 @@ def goldmedalscorechart(user,startdate=None,enddate=None): outids = df.mask(mask)['id'].dropna().unique() # all workouts - alldates,alltestpower,allduration = all_goldmedalstandards(workouts,startdate,enddate) - allids = [w.id for w in workouts] + alldates,alltestpower,allduration,allids = all_goldmedalstandards(workouts,startdate,enddate) + nrdays = (enddate-startdate).days @@ -1853,8 +1855,8 @@ def goldmedalscorechart(user,startdate=None,enddate=None): td.append(arrow.get(w.date).datetime) markerscore.append(testpower[i]) markerduration.append(testduration[i]) - score.append(np.nan) - duration.append(np.nan) + score.append(testpower[i]) + duration.append(testduration[i]) workoutid.append(id) for i in range(len(alldates)): @@ -1883,14 +1885,19 @@ def goldmedalscorechart(user,startdate=None,enddate=None): 'id':workoutid, }) + df['url'] = df['id'].apply(lambda x:settings.SITE_URL+'/rowers/workout/{id}/'.format(id=encoder.encode_hex(x))) + df['workout'] = df['id'].apply(lambda x:workoutname(x)) + df.sort_values(['date'],inplace=True) - df = df.groupby(['date']).max() - df['date'] = df.index.values + # find index values where score is max + idx = df.groupby(['date'])['score'].transform(max) == df['score'] + df = df[idx] + + #df = df.groupby(['date']).max() + #df['date'] = df.index.values - df['url'] = df['id'].apply(lambda x:settings.SITE_URL+'/rowers/workout/{id}/'.format(id=encoder.encode_hex(x))) - df['workout'] = df['id'].apply(lambda x:workoutname(x)) source = ColumnDataSource( diff --git a/rowers/templates/analysis.html b/rowers/templates/analysis.html index e5f11295..68579114 100644 --- a/rowers/templates/analysis.html +++ b/rowers/templates/analysis.html @@ -98,14 +98,15 @@
+
- Monitoring power duration evidence from all your workouts. Feel free to explore. + See which of your workouts are markers of your fitness, and how your scores + evolve over time.