Merge branch 'release/v18.9.5'
This commit is contained in:
@@ -110,6 +110,12 @@ from django.core.exceptions import ValidationError
|
|||||||
from time import strftime
|
from time import strftime
|
||||||
import arrow
|
import arrow
|
||||||
|
|
||||||
|
from rq.job import Job
|
||||||
|
from rq.registry import StartedJobRegistry
|
||||||
|
from redis import Redis
|
||||||
|
from rq import Queue
|
||||||
|
|
||||||
|
|
||||||
thetimezone = get_current_timezone()
|
thetimezone = get_current_timezone()
|
||||||
|
|
||||||
allowedcolumns = [key for key, value in strokedatafields.items()]
|
allowedcolumns = [key for key, value in strokedatafields.items()]
|
||||||
@@ -1542,7 +1548,24 @@ def new_workout_from_df(r, df,
|
|||||||
# A wrapper around the rowingdata class, with some error catching
|
# A wrapper around the rowingdata class, with some error catching
|
||||||
|
|
||||||
|
|
||||||
|
from redis import StrictRedis, Redis
|
||||||
|
|
||||||
|
def get_existing_job(w):
|
||||||
|
# check if this filename is in the queue
|
||||||
|
r = StrictRedis()
|
||||||
|
for key in r.keys():
|
||||||
|
res = key.decode('utf8').split(':')
|
||||||
|
if len(res) == 3:
|
||||||
|
jobid = res[2]
|
||||||
|
try:
|
||||||
|
job = Job.fetch(jobid, connection=r)
|
||||||
|
if isinstance(job.args[1], str):
|
||||||
|
if job.args[1] == w.csvfilename:
|
||||||
|
return 1
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
def workout_trimp(w, reset=False):
|
def workout_trimp(w, reset=False):
|
||||||
r = w.user
|
r = w.user
|
||||||
@@ -1550,6 +1573,9 @@ def workout_trimp(w, reset=False):
|
|||||||
if w.trimp > 0 and not reset:
|
if w.trimp > 0 and not reset:
|
||||||
return w.trimp, w.hrtss
|
return w.trimp, w.hrtss
|
||||||
|
|
||||||
|
if get_existing_job(w):
|
||||||
|
return 0, 0
|
||||||
|
|
||||||
r = w.user
|
r = w.user
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if w.workouttype in otwtypes:
|
if w.workouttype in otwtypes:
|
||||||
@@ -1592,6 +1618,9 @@ def workout_rscore(w, reset=False):
|
|||||||
if w.rscore > 0 and not reset:
|
if w.rscore > 0 and not reset:
|
||||||
return w.rscore, w.normp
|
return w.rscore, w.normp
|
||||||
|
|
||||||
|
if get_existing_job(w):
|
||||||
|
return 0, 0
|
||||||
|
|
||||||
r = w.user
|
r = w.user
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if w.workouttype in otwtypes:
|
if w.workouttype in otwtypes:
|
||||||
@@ -1620,6 +1649,9 @@ def workout_normv(w, pp=4.0):
|
|||||||
if w.normv > 0: # pragma: no cover
|
if w.normv > 0: # pragma: no cover
|
||||||
return w.normv, w.normw
|
return w.normv, w.normw
|
||||||
|
|
||||||
|
if get_existing_job(w):
|
||||||
|
return 0, 0
|
||||||
|
|
||||||
r = w.user
|
r = w.user
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
if w.workouttype in otwtypes:
|
if w.workouttype in otwtypes:
|
||||||
|
|||||||
@@ -320,6 +320,9 @@ def get_execution_report(rower, startdate, enddate, plan=None):
|
|||||||
|
|
||||||
|
|
||||||
def get_indoorraces(workout):
|
def get_indoorraces(workout):
|
||||||
|
if workout is None:
|
||||||
|
return []
|
||||||
|
|
||||||
races1 = VirtualRace.objects.filter(
|
races1 = VirtualRace.objects.filter(
|
||||||
sessiontype='indoorrace',
|
sessiontype='indoorrace',
|
||||||
startdate__lte=workout.date,
|
startdate__lte=workout.date,
|
||||||
@@ -327,6 +330,10 @@ def get_indoorraces(workout):
|
|||||||
sessionmode='distance',
|
sessionmode='distance',
|
||||||
sessionvalue=workout.distance)
|
sessionvalue=workout.distance)
|
||||||
|
|
||||||
|
|
||||||
|
if workout.duration is None:
|
||||||
|
workout.duration = timedelta(0)
|
||||||
|
|
||||||
if workout.duration.second == 0 and workout.duration.microsecond == 0:
|
if workout.duration.second == 0 and workout.duration.microsecond == 0:
|
||||||
duration = 60*workout.duration.hour+workout.duration.minute
|
duration = 60*workout.duration.hour+workout.duration.minute
|
||||||
|
|
||||||
|
|||||||
@@ -3383,6 +3383,22 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
|
|||||||
activeminutesmax=activeminutesmax,
|
activeminutesmax=activeminutesmax,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if metric == 'boat accelerator curve' and data.median().max() < 0.5:
|
||||||
|
data = 9.81*data
|
||||||
|
|
||||||
|
if metric == 'instroke boat speed' and data.median().max() < 0.15:
|
||||||
|
rowdata.add_instroke_speed()
|
||||||
|
rowdata.write_csv(w.csvfilename, gzip=True)
|
||||||
|
data = rowdata.get_instroke_data(
|
||||||
|
metric,
|
||||||
|
spm_min=spm_min,
|
||||||
|
spm_max=spm_max,
|
||||||
|
activeminutesmin=activeminutesmin,
|
||||||
|
activeminutesmax=activeminutesmax,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
script, div = instroke_interactive_chart(
|
script, div = instroke_interactive_chart(
|
||||||
data, metric, w,
|
data, metric, w,
|
||||||
spm_min,
|
spm_min,
|
||||||
|
|||||||
Reference in New Issue
Block a user