correcting bugs in gold medal score
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -98,14 +98,15 @@
|
||||
</p>
|
||||
</li>
|
||||
<li class="rounder">
|
||||
<h2>Power Progress</h2>
|
||||
<a href="/rowers/fitness-progress/">
|
||||
<h2>Marker Workouts</h2>
|
||||
<a href="/rowers/goldmedalscores/">
|
||||
<div class="vignet">
|
||||
<img src="/static/img/powerprogress.png" alt="Power Progress">
|
||||
<img src="/static/img/goldmedalscores.png" alt="Gold Medal Scores">
|
||||
</div>
|
||||
</a>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
</li>
|
||||
<li class="rounder">
|
||||
|
||||
BIN
static/img/goldmedalscores.png
Normal file
BIN
static/img/goldmedalscores.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Reference in New Issue
Block a user