Merge tag 'v6.41' into develop
hotfix hrftp
This commit is contained in:
@@ -2307,7 +2307,7 @@ def workout_trimp(workout):
|
||||
r = workout.user
|
||||
if r.hrftp == 0:
|
||||
hrftp = (r.an+r.tr)/2.
|
||||
r.hrftp = hrftp
|
||||
r.hrftp = int(hrftp)
|
||||
r.save()
|
||||
|
||||
df,row = getrowdata_db(id=workout.id)
|
||||
@@ -2316,8 +2316,14 @@ def workout_trimp(workout):
|
||||
df,row = getrowdata_db(id=workout.id)
|
||||
df = clean_df_stats(df,workstrokesonly=False)
|
||||
trimp,hrtss = calc_trimp(df,r.sex,r.max,r.rest,r.hrftp)
|
||||
trimp = int(trimp)
|
||||
hrtss = int(hrtss)
|
||||
if not np.isnan(trimp):
|
||||
trimp = int(trimp)
|
||||
else:
|
||||
trimp = 0
|
||||
if not np.isnan(hrtss):
|
||||
hrtss = int(hrtss)
|
||||
else:
|
||||
hrtss = 0
|
||||
|
||||
return trimp,hrtss
|
||||
|
||||
|
||||
@@ -352,8 +352,9 @@ def calc_trimp(df,sex,hrmax,hrmin,hrftp):
|
||||
dt = df['time'].diff()/6.e4
|
||||
|
||||
hrr = (df['hr']-hrmin)/(hrmax-hrmin)
|
||||
hrrftp = (hrftp-hrmin)/(hrmax-hrmin)
|
||||
hrrftp = (hrftp-hrmin)/float(hrmax-hrmin)
|
||||
trimp1hr = 60*hrrftp*0.64*np.exp(f*hrrftp)
|
||||
|
||||
trimpdata = dt*hrr*0.64*np.exp(f*hrr)
|
||||
trimp = trimpdata.sum()
|
||||
|
||||
|
||||
@@ -131,10 +131,10 @@ def is_manager(user):
|
||||
r = Rower.objects.get(user=user)
|
||||
return r.rowerplan == 'coach'
|
||||
|
||||
from rowers.views import hasplannedsessions
|
||||
@register.filter
|
||||
def is_planmember(user):
|
||||
r = Rower.objects.get(user=user)
|
||||
return r.rowerplan == 'plan' or r.rowerplan == 'coach'
|
||||
return hasplannedsessions(user)
|
||||
|
||||
@register.filter
|
||||
def user_teams(user):
|
||||
|
||||
Reference in New Issue
Block a user