Merge branch 'release/v12.20'
This commit is contained in:
@@ -16,7 +16,7 @@ braintree==3.55.0
|
||||
cairocffi==1.0.2
|
||||
celery==4.3.0
|
||||
certifi==2019.3.9
|
||||
cffi==1.12.2
|
||||
cffi==1.14.0
|
||||
chardet==3.0.4
|
||||
Click==7.0
|
||||
cloudpickle==1.2.2
|
||||
@@ -126,7 +126,7 @@ nose==1.3.7
|
||||
nose-parameterized==0.6.0
|
||||
notebook==5.7.6
|
||||
numba==0.46.0
|
||||
numpy==1.16.2
|
||||
numpy==1.18.3
|
||||
oauth2==1.9.0.post1
|
||||
oauthlib==3.0.1
|
||||
openapi-codec==1.3.2
|
||||
@@ -175,11 +175,11 @@ ratelim==0.1.6
|
||||
redis==3.2.1
|
||||
requests==2.21.0
|
||||
requests-oauthlib==1.2.0
|
||||
rowingdata==2.8.3
|
||||
rowingdata==2.8.4
|
||||
rowingphysics==0.5.0
|
||||
rq==0.13.0
|
||||
rules==2.1
|
||||
scipy==1.4.1
|
||||
scipy==1.2.1
|
||||
SecretStorage==3.1.1
|
||||
Send2Trash==1.5.0
|
||||
shell==1.0.1
|
||||
|
||||
@@ -697,6 +697,14 @@ class Rower(models.Model):
|
||||
('Workout','Workout'),
|
||||
('Yoga','Yoga'),
|
||||
)
|
||||
|
||||
gridtypes = (
|
||||
('none',None),
|
||||
('both','both'),
|
||||
('x','x'),
|
||||
('y','y'),
|
||||
)
|
||||
|
||||
user = models.OneToOneField(User,on_delete=models.CASCADE)
|
||||
|
||||
#billing details
|
||||
@@ -880,6 +888,10 @@ class Rower(models.Model):
|
||||
showfavoritechartnotes = models.BooleanField(default=True,
|
||||
verbose_name='Show Notes for Favorite Charts')
|
||||
|
||||
# Static chart settings
|
||||
staticgrids = models.CharField(default=None,choices=gridtypes,null=True,max_length=50,
|
||||
verbose_name='Chart Grid')
|
||||
|
||||
def __str__(self):
|
||||
return self.user.first_name+' '+self.user.last_name
|
||||
|
||||
@@ -3438,7 +3450,15 @@ class AccountRowerForm(ModelForm):
|
||||
if 'coach' not in self.instance.rowerplan:
|
||||
self.fields.pop('offercoaching')
|
||||
|
||||
# Form to set static chart settings
|
||||
class StaticChartRowerForm(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = ['staticgrids']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(StaticChartRowerForm, self).__init__(*args, **kwargs)
|
||||
self.fields['staticgrids'].required = False
|
||||
|
||||
|
||||
class UserForm(ModelForm):
|
||||
|
||||
@@ -1902,34 +1902,34 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
|
||||
row.df = df
|
||||
nr_rows = len(row.df)
|
||||
if (plotnr == 1):
|
||||
fig1 = row.get_timeplot_erg(t)
|
||||
fig1 = row.get_timeplot_erg(t,**kwargs)
|
||||
elif (plotnr == 2):
|
||||
fig1 = row.get_metersplot_erg(t)
|
||||
fig1 = row.get_metersplot_erg(t,**kwargs)
|
||||
elif (plotnr == 3):
|
||||
t += ' - Heart Rate Distribution'
|
||||
fig1 = row.get_piechart(t)
|
||||
fig1 = row.get_piechart(t,**kwargs)
|
||||
elif (plotnr == 4):
|
||||
if haspower:
|
||||
fig1 = row.get_timeplot_otwempower(t)
|
||||
fig1 = row.get_timeplot_otwempower(t,**kwargs)
|
||||
else:
|
||||
fig1 = row.get_timeplot_otw(t)
|
||||
fig1 = row.get_timeplot_otw(t,**kwargs)
|
||||
elif (plotnr == 5):
|
||||
if haspower:
|
||||
fig1 = row.get_metersplot_otwempower(t)
|
||||
fig1 = row.get_metersplot_otwempower(t,**kwargs)
|
||||
else:
|
||||
fig1 = row.get_metersplot_otw(t)
|
||||
fig1 = row.get_metersplot_otw(t,**kwargs)
|
||||
elif (plotnr == 6):
|
||||
t += ' - Heart Rate Distribution'
|
||||
fig1 = row.get_piechart(t)
|
||||
fig1 = row.get_piechart(t,**kwargs)
|
||||
elif (plotnr == 7) or (plotnr == 10):
|
||||
fig1 = row.get_metersplot_erg2(t)
|
||||
fig1 = row.get_metersplot_erg2(t,**kwargs)
|
||||
elif (plotnr == 8) or (plotnr == 11):
|
||||
fig1 = row.get_timeplot_erg2(t)
|
||||
fig1 = row.get_timeplot_erg2(t,**kwargs)
|
||||
elif (plotnr == 9) or (plotnr == 12):
|
||||
fig1 = row.get_time_otwpower(t)
|
||||
fig1 = row.get_time_otwpower(t,**kwargs)
|
||||
elif (plotnr == 13) or (plotnr == 16):
|
||||
t += ' - Power Distribution'
|
||||
fig1 = row.get_power_piechart(t)
|
||||
fig1 = row.get_power_piechart(t,**kwargs)
|
||||
|
||||
if fig1 is None:
|
||||
return 0
|
||||
|
||||
@@ -1,8 +1,21 @@
|
||||
{% extends "newbase.html" %}
|
||||
|
||||
{% block title %}Change Favorite Charts{% endblock %}
|
||||
{% block title %}Change Charts Settings {% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<h1>Static Charts Settings of {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
<p>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<table with=100%>
|
||||
{{ staticchartform.as_table }}
|
||||
</table>
|
||||
<input type="submit" value="Save" class="button"/>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
|
||||
<h1>Change Favorite Charts of {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||
|
||||
<form method="post">
|
||||
@@ -10,7 +23,7 @@
|
||||
{% csrf_token %}
|
||||
<li class="grid_4">
|
||||
<div class="fav-form-header">
|
||||
<p><input type="submit" value="Update Favorites" class="button green small"/></p>
|
||||
<p><input type="submit" value="Update Favorites" class="button"/></p>
|
||||
</div>
|
||||
{{ favorites_formset.management_form }}
|
||||
</li>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</li>
|
||||
<li id="manage-favs">
|
||||
<a href="/rowers/me/favoritecharts/">
|
||||
<i class="fas fa-chart-area fa-fw"></i> Favorite Charts
|
||||
<i class="fas fa-chart-area fa-fw"></i> Charts Settings
|
||||
</a>
|
||||
</li>
|
||||
<li id="manage-workflow">
|
||||
|
||||
@@ -441,6 +441,13 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
||||
'pieplot':3,
|
||||
}
|
||||
|
||||
axis = r.staticgrids
|
||||
if axis == None:
|
||||
gridtrue = False
|
||||
axis = 'both'
|
||||
else:
|
||||
gridtrue = True
|
||||
|
||||
if plotnr == 0:
|
||||
plotnr = plotnrs[plottype]
|
||||
|
||||
@@ -450,7 +457,7 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
||||
|
||||
job = myqueue(queuehigh,handle_makeplot,f1,f2,
|
||||
title,hrpwrdata,
|
||||
plotnr,imagename)
|
||||
plotnr,imagename,gridtrue=gridtrue,axis=axis)
|
||||
|
||||
try:
|
||||
width,height = Image.open(fullpathimagename).size
|
||||
|
||||
@@ -127,7 +127,7 @@ from rowers.models import (
|
||||
VirtualRaceForm,VirtualRaceResultForm,RowerImportExportForm,
|
||||
IndoorVirtualRaceResultForm,IndoorVirtualRaceResult,
|
||||
IndoorVirtualRaceForm,PlannedSessionCommentForm,
|
||||
Alert, Condition
|
||||
Alert, Condition, StaticChartRowerForm
|
||||
)
|
||||
from rowers.models import (
|
||||
FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement,BasePlannedSessionFormSet,
|
||||
|
||||
@@ -220,6 +220,9 @@ def rower_favoritecharts_view(request,userid=0):
|
||||
message = ''
|
||||
successmessage = ''
|
||||
r = getrequestrower(request,userid=userid,notpermanent=True)
|
||||
|
||||
staticchartform = StaticChartRowerForm(instance=r)
|
||||
|
||||
favorites = FavoriteChart.objects.filter(user=r).order_by('id')
|
||||
aantal = len(favorites)
|
||||
favorites_data = [{'yparam1':f.yparam1,
|
||||
@@ -234,8 +237,13 @@ def rower_favoritecharts_view(request,userid=0):
|
||||
if aantal==0:
|
||||
FavoriteChartFormSet = formset_factory(FavoriteForm,formset=BaseFavoriteFormSet,extra=1)
|
||||
|
||||
if request.method == 'POST' and 'staticgrids' in request.POST:
|
||||
staticchartform = StaticChartRowerForm(request.POST,instance=r)
|
||||
if staticchartform.is_valid():
|
||||
r.staticgrids = staticchartform.cleaned_data.get('staticgrids')
|
||||
r.save()
|
||||
|
||||
if request.method == 'POST':
|
||||
if request.method == 'POST' and 'form-TOTAL_FORMS' in request.POST:
|
||||
favorites_formset = FavoriteChartFormSet(request.POST)
|
||||
if favorites_formset.is_valid():
|
||||
new_instances = []
|
||||
@@ -275,6 +283,7 @@ def rower_favoritecharts_view(request,userid=0):
|
||||
'favorites_formset':favorites_formset,
|
||||
'teams':get_my_teams(request.user),
|
||||
'rower':r,
|
||||
'staticchartform':staticchartform,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user