Merge branch 'release/v12.21'
This commit is contained in:
@@ -892,6 +892,15 @@ class Rower(models.Model):
|
|||||||
staticgrids = models.CharField(default=None,choices=gridtypes,null=True,max_length=50,
|
staticgrids = models.CharField(default=None,choices=gridtypes,null=True,max_length=50,
|
||||||
verbose_name='Chart Grid')
|
verbose_name='Chart Grid')
|
||||||
|
|
||||||
|
ergpaceslow = datetime.timedelta(seconds=160)
|
||||||
|
ergpacefast = datetime.timedelta(seconds=85)
|
||||||
|
otwpaceslow = datetime.timedelta(seconds=240)
|
||||||
|
otwpacefast = datetime.timedelta(seconds=85)
|
||||||
|
slowpaceerg = models.DurationField(default=ergpaceslow,verbose_name='Slowest Erg Pace')
|
||||||
|
fastpaceerg = models.DurationField(default=ergpacefast,verbose_name='Fastest Erg Pace')
|
||||||
|
slowpaceotw = models.DurationField(default=otwpaceslow,verbose_name='Slowest OTW Pace')
|
||||||
|
fastpaceotw = models.DurationField(default=otwpacefast,verbose_name='Fastest OTW Pace')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.first_name+' '+self.user.last_name
|
return self.user.first_name+' '+self.user.last_name
|
||||||
|
|
||||||
@@ -3454,7 +3463,7 @@ class AccountRowerForm(ModelForm):
|
|||||||
class StaticChartRowerForm(ModelForm):
|
class StaticChartRowerForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Rower
|
model = Rower
|
||||||
fields = ['staticgrids']
|
fields = ['staticgrids','slowpaceerg','fastpaceerg','slowpaceotw','fastpaceotw']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(StaticChartRowerForm, self).__init__(*args, **kwargs)
|
super(StaticChartRowerForm, self).__init__(*args, **kwargs)
|
||||||
|
|||||||
@@ -1894,6 +1894,9 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
|
|||||||
except (TypeError, KeyError):
|
except (TypeError, KeyError):
|
||||||
haspower = False
|
haspower = False
|
||||||
|
|
||||||
|
oterange = kwargs.pop('oterange',[85,240])
|
||||||
|
otwrange = kwargs.pop('otwrange',[85,185])
|
||||||
|
|
||||||
|
|
||||||
nr_rows = len(row.df)
|
nr_rows = len(row.df)
|
||||||
if (plotnr in [1, 2, 4, 5, 8, 11, 9, 12]) and (nr_rows > 1200):
|
if (plotnr in [1, 2, 4, 5, 8, 11, 9, 12]) and (nr_rows > 1200):
|
||||||
@@ -1902,22 +1905,22 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
|
|||||||
row.df = df
|
row.df = df
|
||||||
nr_rows = len(row.df)
|
nr_rows = len(row.df)
|
||||||
if (plotnr == 1):
|
if (plotnr == 1):
|
||||||
fig1 = row.get_timeplot_erg(t,**kwargs)
|
fig1 = row.get_timeplot_erg(t,pacerange=oterange,**kwargs)
|
||||||
elif (plotnr == 2):
|
elif (plotnr == 2):
|
||||||
fig1 = row.get_metersplot_erg(t,**kwargs)
|
fig1 = row.get_metersplot_erg(t,pacerange=oterange,**kwargs)
|
||||||
elif (plotnr == 3):
|
elif (plotnr == 3):
|
||||||
t += ' - Heart Rate Distribution'
|
t += ' - Heart Rate Distribution'
|
||||||
fig1 = row.get_piechart(t,**kwargs)
|
fig1 = row.get_piechart(t,**kwargs)
|
||||||
elif (plotnr == 4):
|
elif (plotnr == 4):
|
||||||
if haspower:
|
if haspower:
|
||||||
fig1 = row.get_timeplot_otwempower(t,**kwargs)
|
fig1 = row.get_timeplot_otwempower(t,pacerange=otwrange,**kwargs)
|
||||||
else:
|
else:
|
||||||
fig1 = row.get_timeplot_otw(t,**kwargs)
|
fig1 = row.get_timeplot_otw(t,pacerange=otwrange,**kwargs)
|
||||||
elif (plotnr == 5):
|
elif (plotnr == 5):
|
||||||
if haspower:
|
if haspower:
|
||||||
fig1 = row.get_metersplot_otwempower(t,**kwargs)
|
fig1 = row.get_metersplot_otwempower(t,pacerange=otwrange,**kwargs)
|
||||||
else:
|
else:
|
||||||
fig1 = row.get_metersplot_otw(t,**kwargs)
|
fig1 = row.get_metersplot_otw(t,pacerange=otwrange,**kwargs)
|
||||||
elif (plotnr == 6):
|
elif (plotnr == 6):
|
||||||
t += ' - Heart Rate Distribution'
|
t += ' - Heart Rate Distribution'
|
||||||
fig1 = row.get_piechart(t,**kwargs)
|
fig1 = row.get_piechart(t,**kwargs)
|
||||||
@@ -1926,7 +1929,7 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
|
|||||||
elif (plotnr == 8) or (plotnr == 11):
|
elif (plotnr == 8) or (plotnr == 11):
|
||||||
fig1 = row.get_timeplot_erg2(t,**kwargs)
|
fig1 = row.get_timeplot_erg2(t,**kwargs)
|
||||||
elif (plotnr == 9) or (plotnr == 12):
|
elif (plotnr == 9) or (plotnr == 12):
|
||||||
fig1 = row.get_time_otwpower(t,**kwargs)
|
fig1 = row.get_time_otwpower(t,pacerange=otwrange,**kwargs)
|
||||||
elif (plotnr == 13) or (plotnr == 16):
|
elif (plotnr == 13) or (plotnr == 16):
|
||||||
t += ' - Power Distribution'
|
t += ' - Power Distribution'
|
||||||
fig1 = row.get_power_piechart(t,**kwargs)
|
fig1 = row.get_power_piechart(t,**kwargs)
|
||||||
|
|||||||
@@ -5,6 +5,12 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Static Charts Settings of {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
<h1>Static Charts Settings of {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Use this form to change some of the characteristics of the static charts. The grid option
|
||||||
|
overlays grid lines over the charts. The fastest and slowest pace determine cutoff values for
|
||||||
|
pace.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|||||||
@@ -454,10 +454,14 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
|||||||
if w.workouttype in otwtypes:
|
if w.workouttype in otwtypes:
|
||||||
plotnr = plotnr+3
|
plotnr = plotnr+3
|
||||||
|
|
||||||
|
otwrange = [r.fastpaceotw.total_seconds(),r.slowpaceotw.total_seconds()]
|
||||||
|
oterange = [r.fastpaceerg.total_seconds(),r.slowpaceerg.total_seconds()]
|
||||||
|
|
||||||
|
|
||||||
job = myqueue(queuehigh,handle_makeplot,f1,f2,
|
job = myqueue(queuehigh,handle_makeplot,f1,f2,
|
||||||
title,hrpwrdata,
|
title,hrpwrdata,
|
||||||
plotnr,imagename,gridtrue=gridtrue,axis=axis)
|
plotnr,imagename,gridtrue=gridtrue,axis=axis,
|
||||||
|
otwrange=otwrange,oterange=oterange)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
width,height = Image.open(fullpathimagename).size
|
width,height = Image.open(fullpathimagename).size
|
||||||
|
|||||||
@@ -241,6 +241,10 @@ def rower_favoritecharts_view(request,userid=0):
|
|||||||
staticchartform = StaticChartRowerForm(request.POST,instance=r)
|
staticchartform = StaticChartRowerForm(request.POST,instance=r)
|
||||||
if staticchartform.is_valid():
|
if staticchartform.is_valid():
|
||||||
r.staticgrids = staticchartform.cleaned_data.get('staticgrids')
|
r.staticgrids = staticchartform.cleaned_data.get('staticgrids')
|
||||||
|
r.slowpaceerg = staticchartform.cleaned_data.get('slowpaceerg')
|
||||||
|
r.fastpaceerg = staticchartform.cleaned_data.get('fastpaceerg')
|
||||||
|
r.slowpaceotw = staticchartform.cleaned_data.get('slowpaceotw')
|
||||||
|
r.fastpaceotw = staticchartform.cleaned_data.get('fastpaceotw')
|
||||||
r.save()
|
r.save()
|
||||||
|
|
||||||
if request.method == 'POST' and 'form-TOTAL_FORMS' in request.POST:
|
if request.method == 'POST' and 'form-TOTAL_FORMS' in request.POST:
|
||||||
|
|||||||
Reference in New Issue
Block a user