Private
Public Access
1
0

perf chart and gms chart now use rankingpiece

This commit is contained in:
Sander Roosendaal
2021-01-06 21:58:28 +01:00
parent 67fc069cf6
commit 44669eaa5d
2 changed files with 27 additions and 40 deletions

View File

@@ -1104,10 +1104,15 @@ def workout_goldmedalstandard(workout):
def check_marker(workout):
r = workout.user
gmstandard,gmseconds = workout_goldmedalstandard(workout)
if gmseconds<60:
return None
dd = arrow.get(workout.date).datetime-datetime.timedelta(days=r.kfit)
ws = Workout.objects.filter(date__gte=dd,
date__lte=workout.date,
user=r,duplicate=False,
workouttype__in=mytypes.rowtypes,
).order_by("date")
ids = []
gms = []

View File

@@ -1801,9 +1801,17 @@ def goldmedalscorechart(user,startdate=None,enddate=None):
duplicate=False)
# marker workouts
dates,testpower,testduration,fatigues,fitnesses,impulses, outids = build_goldmedalstandards(
workouts,42
)
workouts = Workout.objects.filter(user=user.rower,date__gte=startdate,
date__lte=enddate,
workouttype__in=mytypes.rowtypes,
duplicate=False).order_by('date')
markerworkouts = workouts.filter(rankingpiece=True)
outids = [w.id for w in markerworkouts]
dates = [arrow.get(w.date).datetime for w in markerworkouts]
testpower = [w.goldmedalstandard if w.rankingpiece else np.nan for w in markerworkouts]
testduration = [w.goldmedalseconds if w.rankingpiece else 0 for w in markerworkouts]
df = pd.DataFrame({
'id':outids,
@@ -1813,8 +1821,8 @@ def goldmedalscorechart(user,startdate=None,enddate=None):
})
df.sort_values(['date'],inplace=True)
df['testdup'] = df['testpower'].shift(1)
df['testpower'] = df.apply(lambda x: newtestpower(x),axis=1)
#df['testdup'] = df['testpower'].shift(1)
#df['testpower'] = df.apply(lambda x: newtestpower(x),axis=1)
#df['date'] = df.apply(lambda x: newtestpowerdate(x), axis=1)
@@ -1985,41 +1993,16 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
workouts = Workout.objects.filter(user=user.rower,date__gte=startdate,
date__lte=enddate,
workouttype__in=mytypes.rowtypes,
duplicate=False)
dates,testpower,testduration,fatigues,fitnesses,impulses, outids = build_goldmedalstandards(
workouts,kfitness
)
duplicate=False).order_by('date')
df = pd.DataFrame({
'id': outids,
'date':dates,
'testpower':testpower,
'testduration':testduration,
'fatigue':fatigues,
'fitness':fitnesses,
'impulse':impulses,
})
df.sort_values(['date'],inplace=True)
if showtests:
df['testdup'] = df['testpower'].shift(1)
df['testpower'] = df.apply(lambda x: newtestpower(x),axis=1)
df['id'] = df.apply(lambda x: newtestpowerid(x),axis=1)
#try:
# df['testpower'].iloc[-1] = df['testdup'].iloc[-1]
#except IndexError:
# pass
dates = [d for d in df['date']]
testpower = df['testpower'].values.tolist()
fatigues = df['fatigue'].values.tolist()
fitnesses = df['fitness'].values.tolist()
testduration = df['testduration'].values.tolist()
impulses = df['impulse'].tolist()
outids = df['id'].unique()
markerworkouts = workouts.filter(rankingpiece=True)
outids = [w.id for w in markerworkouts]
dates = [arrow.get(w.date).datetime for w in workouts]
testpower = [w.goldmedalstandard if w.rankingpiece else np.nan for w in workouts]
impulses = [np.nan for w in workouts]
testduration = [w.goldmedalseconds if w.rankingpiece else 0 for w in workouts]
fitnesses = [np.nan for w in workouts]
fatigues = [np.nan for w in workouts]
fatigues,fitnesses,dates,testpower,testduration,impulses = getfatigues(fatigues,
fitnesses,
@@ -2031,7 +2014,6 @@ def performance_chart(user,startdate=None,enddate=None,kfitness=42,kfatigue=7,
kfatigue,kfitness)
df = pd.DataFrame({
'date':dates,
'testpower':testpower,