fix
This commit is contained in:
@@ -115,6 +115,34 @@ from rq.registry import StartedJobRegistry
|
|||||||
from redis import Redis
|
from redis import Redis
|
||||||
from rq import Queue
|
from rq import Queue
|
||||||
|
|
||||||
|
from rowers.datautils import rpetotss
|
||||||
|
|
||||||
|
def rscore_approx(row):
|
||||||
|
if row['rscore'] > 0:
|
||||||
|
return row['rscore']
|
||||||
|
if row['rscore'] == 0:
|
||||||
|
if row['hrtss'] > 0:
|
||||||
|
return row['hrtss']
|
||||||
|
else:
|
||||||
|
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
||||||
|
dd = dd/3600
|
||||||
|
print(row['rpe'],dd,rpetotss[row['rpe']])
|
||||||
|
return rpetotss[row['rpe']]*dd
|
||||||
|
if row['rscore'] < 0:
|
||||||
|
w = Workout.objects.get(id=row['id'])
|
||||||
|
trimp, hrtss = workout_trimp(w)
|
||||||
|
rscore, normp = workout_rscore(w)
|
||||||
|
if row['rpe'] and row['rpe'] > 0:
|
||||||
|
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
||||||
|
dd = dd/3600
|
||||||
|
return rpetotss[row['rpe']]*dd
|
||||||
|
else: # pragma: no cover
|
||||||
|
minutes = row['duration'].hour*60+row['duration'].minute
|
||||||
|
return minutes
|
||||||
|
|
||||||
|
print('boer')
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
thetimezone = get_current_timezone()
|
thetimezone = get_current_timezone()
|
||||||
|
|
||||||
|
|||||||
@@ -23,31 +23,6 @@ rpetotss = {
|
|||||||
10: 140,
|
10: 140,
|
||||||
}
|
}
|
||||||
|
|
||||||
def rscore_approx(row):
|
|
||||||
if row['rscore'] > 0:
|
|
||||||
return row['rscore']
|
|
||||||
if row['rscore'] == 0:
|
|
||||||
if row['hrtss'] > 0:
|
|
||||||
return row['hrtss']
|
|
||||||
else:
|
|
||||||
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
|
||||||
dd = dd/3600
|
|
||||||
print(row['rpe'],dd,rpetotss[row['rpe']])
|
|
||||||
return rpetotss[row['rpe']]*dd
|
|
||||||
if row['rscore'] < 0:
|
|
||||||
w = Workout.objects.get(id=row['id'])
|
|
||||||
trimp, hrtss = dataprep.workout_trimp(w)
|
|
||||||
rscore, normp = dataprep.workout_rscore(w)
|
|
||||||
if row['rpe'] and row['rpe'] > 0:
|
|
||||||
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
|
||||||
dd = dd/3600
|
|
||||||
return rpetotss[row['rpe']]*dd
|
|
||||||
else: # pragma: no cover
|
|
||||||
minutes = row['duration'].hour*60+row['duration'].minute
|
|
||||||
return minutes
|
|
||||||
|
|
||||||
print('boer')
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def updatecp(delta, cpvalues, r, workouttype='water'): # pragma: no cover
|
def updatecp(delta, cpvalues, r, workouttype='water'): # pragma: no cover
|
||||||
if workouttype in otwtypes:
|
if workouttype in otwtypes:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from rowers.metrics import axes, axlabels, yaxminima, yaxmaxima, get_yaxminima, get_yaxmaxima
|
from rowers.metrics import axes, axlabels, yaxminima, yaxmaxima, get_yaxminima, get_yaxmaxima
|
||||||
from rowers.dataprep import nicepaceformat, niceformat, strfdelta
|
from rowers.dataprep import nicepaceformat, niceformat, strfdelta
|
||||||
from rowers.datautils import p0, rpetotss, rscore_approx
|
from rowers.datautils import p0, rpetotss
|
||||||
from rowers.metrics import rowingmetrics, metricsdicts
|
from rowers.metrics import rowingmetrics, metricsdicts
|
||||||
from scipy.spatial import ConvexHull, Delaunay
|
from scipy.spatial import ConvexHull, Delaunay
|
||||||
from scipy.stats import linregress, percentileofscore
|
from scipy.stats import linregress, percentileofscore
|
||||||
@@ -9,7 +9,7 @@ from rowers.models import course_spline, VirtualRaceResult, InStrokeAnalysis, Fo
|
|||||||
from bokeh.palettes import Category20c, Category10
|
from bokeh.palettes import Category20c, Category10
|
||||||
from bokeh.layouts import layout
|
from bokeh.layouts import layout
|
||||||
from bokeh.resources import CDN, INLINE
|
from bokeh.resources import CDN, INLINE
|
||||||
from rowers.dataprep import timedeltaconv
|
from rowers.dataprep import timedeltaconv, rscore_approx
|
||||||
from pandas.core.groupby.groupby import DataError
|
from pandas.core.groupby.groupby import DataError
|
||||||
import rowers.datautils as datautils
|
import rowers.datautils as datautils
|
||||||
from rowers.utils import lbstoN
|
from rowers.utils import lbstoN
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ def get_execution_report(rower, startdate, enddate, plan=None):
|
|||||||
'duration': w.duration,
|
'duration': w.duration,
|
||||||
'id': w.id
|
'id': w.id
|
||||||
}
|
}
|
||||||
rscore = datautils.rscore_approx(row)
|
rscore = dataprep.rscore_approx(row)
|
||||||
actualscore += rscore
|
actualscore += rscore
|
||||||
|
|
||||||
for ps in sps: # pragma: no cover
|
for ps in sps: # pragma: no cover
|
||||||
@@ -586,7 +586,7 @@ def get_session_metrics(ps):
|
|||||||
'duration': w.duration,
|
'duration': w.duration,
|
||||||
'id': w.id
|
'id': w.id
|
||||||
}
|
}
|
||||||
tss = datautils.rscore_approx(row)
|
tss = dataprep.rscore_approx(row)
|
||||||
rscorev += tss
|
rscorev += tss
|
||||||
|
|
||||||
ratio, statusv, completiondate = is_session_complete_ws(ws, ps)
|
ratio, statusv, completiondate = is_session_complete_ws(ws, ps)
|
||||||
@@ -688,7 +688,7 @@ def is_session_complete_ws(ws, ps):
|
|||||||
'duration': w.duration,
|
'duration': w.duration,
|
||||||
'id': w.id
|
'id': w.id
|
||||||
}
|
}
|
||||||
rscore = datautils.rscore_approx(row)
|
rscore = dataprep.rscore_approx(row)
|
||||||
score += rscore
|
score += rscore
|
||||||
if not completiondate and score >= cratiomin*value:
|
if not completiondate and score >= cratiomin*value:
|
||||||
completiondate = w.date
|
completiondate = w.date
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user