correcting bugs in gold medal score
This commit is contained in:
@@ -144,6 +144,7 @@ def all_goldmedalstandards(workouts,startdate,enddate):
|
|||||||
dates = []
|
dates = []
|
||||||
testpowers = []
|
testpowers = []
|
||||||
testduration = []
|
testduration = []
|
||||||
|
ids = []
|
||||||
|
|
||||||
for w in workouts:
|
for w in workouts:
|
||||||
goldmedalstandard, goldmedalseconds = dataprep.workout_goldmedalstandard(w)
|
goldmedalstandard, goldmedalseconds = dataprep.workout_goldmedalstandard(w)
|
||||||
@@ -151,8 +152,9 @@ def all_goldmedalstandards(workouts,startdate,enddate):
|
|||||||
dates.append(arrow.get(w.date).datetime)
|
dates.append(arrow.get(w.date).datetime)
|
||||||
testpowers.append(goldmedalstandard)
|
testpowers.append(goldmedalstandard)
|
||||||
testduration.append(goldmedalseconds)
|
testduration.append(goldmedalseconds)
|
||||||
|
ids.append(w.id)
|
||||||
|
|
||||||
return dates,testpowers,testduration
|
return dates,testpowers,testduration,ids
|
||||||
|
|
||||||
def build_goldmedalstandards(workouts,kfitness):
|
def build_goldmedalstandards(workouts,kfitness):
|
||||||
dates = []
|
dates = []
|
||||||
@@ -1831,8 +1833,8 @@ def goldmedalscorechart(user,startdate=None,enddate=None):
|
|||||||
outids = df.mask(mask)['id'].dropna().unique()
|
outids = df.mask(mask)['id'].dropna().unique()
|
||||||
|
|
||||||
# all workouts
|
# all workouts
|
||||||
alldates,alltestpower,allduration = all_goldmedalstandards(workouts,startdate,enddate)
|
alldates,alltestpower,allduration,allids = all_goldmedalstandards(workouts,startdate,enddate)
|
||||||
allids = [w.id for w in workouts]
|
|
||||||
|
|
||||||
nrdays = (enddate-startdate).days
|
nrdays = (enddate-startdate).days
|
||||||
|
|
||||||
@@ -1853,8 +1855,8 @@ def goldmedalscorechart(user,startdate=None,enddate=None):
|
|||||||
td.append(arrow.get(w.date).datetime)
|
td.append(arrow.get(w.date).datetime)
|
||||||
markerscore.append(testpower[i])
|
markerscore.append(testpower[i])
|
||||||
markerduration.append(testduration[i])
|
markerduration.append(testduration[i])
|
||||||
score.append(np.nan)
|
score.append(testpower[i])
|
||||||
duration.append(np.nan)
|
duration.append(testduration[i])
|
||||||
workoutid.append(id)
|
workoutid.append(id)
|
||||||
|
|
||||||
for i in range(len(alldates)):
|
for i in range(len(alldates)):
|
||||||
@@ -1883,14 +1885,19 @@ def goldmedalscorechart(user,startdate=None,enddate=None):
|
|||||||
'id':workoutid,
|
'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.sort_values(['date'],inplace=True)
|
||||||
|
|
||||||
df = df.groupby(['date']).max()
|
# find index values where score is max
|
||||||
df['date'] = df.index.values
|
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(
|
source = ColumnDataSource(
|
||||||
|
|||||||
@@ -98,14 +98,15 @@
|
|||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="rounder">
|
<li class="rounder">
|
||||||
<h2>Power Progress</h2>
|
<h2>Marker Workouts</h2>
|
||||||
<a href="/rowers/fitness-progress/">
|
<a href="/rowers/goldmedalscores/">
|
||||||
<div class="vignet">
|
<div class="vignet">
|
||||||
<img src="/static/img/powerprogress.png" alt="Power Progress">
|
<img src="/static/img/goldmedalscores.png" alt="Gold Medal Scores">
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<p>
|
<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>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="rounder">
|
<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