implemented default set of flex favs on user registration
This commit is contained in:
@@ -219,7 +219,7 @@ rowingmetrics = (
|
|||||||
'ax_max': 15,
|
'ax_max': 15,
|
||||||
'default': 0,
|
'default': 0,
|
||||||
'mode':'both',
|
'mode':'both',
|
||||||
'type': 'pro'}),
|
'type': 'basic'}),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -236,3 +236,60 @@ axlabels = {ax[0]:ax[1] for ax in axes}
|
|||||||
yaxminima = {ax[0]:ax[2] for ax in axes}
|
yaxminima = {ax[0]:ax[2] for ax in axes}
|
||||||
|
|
||||||
yaxmaxima = {ax[0]:ax[3] for ax in axes}
|
yaxmaxima = {ax[0]:ax[3] for ax in axes}
|
||||||
|
|
||||||
|
defaultfavoritecharts = (
|
||||||
|
{
|
||||||
|
'yparam1':'pace',
|
||||||
|
'yparam2':'spm',
|
||||||
|
'xparam':'time',
|
||||||
|
'plottype':'line',
|
||||||
|
'workouttype':'both',
|
||||||
|
'reststrokes':True,
|
||||||
|
'notes':'Some Notes 1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'yparam1':'pace',
|
||||||
|
'yparam2':'hr',
|
||||||
|
'xparam':'time',
|
||||||
|
'plottype':'line',
|
||||||
|
'workouttype':'both',
|
||||||
|
'reststrokes':True,
|
||||||
|
'notes':'Some Notes 2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'yparam1':'distanceperstroke',
|
||||||
|
'yparam2':'hr',
|
||||||
|
'xparam':'time',
|
||||||
|
'plottype':'line',
|
||||||
|
'workouttype':'otw',
|
||||||
|
'reststrokes':True,
|
||||||
|
'notes':'Some Notes 3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'yparam1':'strokeenergy',
|
||||||
|
'yparam2':'hr',
|
||||||
|
'xparam':'time',
|
||||||
|
'plottype':'line',
|
||||||
|
'workouttype':'ote',
|
||||||
|
'reststrokes':True,
|
||||||
|
'notes':'Some Notes 3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'yparam1':'distanceperstroke',
|
||||||
|
'yparam2':'None',
|
||||||
|
'xparam':'spm',
|
||||||
|
'plottype':'line',
|
||||||
|
'workouttype':'otw',
|
||||||
|
'reststrokes':True,
|
||||||
|
'notes':'Some Notes 4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'yparam1':'strokeenergy',
|
||||||
|
'yparam2':'None',
|
||||||
|
'xparam':'spm',
|
||||||
|
'plottype':'line',
|
||||||
|
'workouttype':'ote',
|
||||||
|
'reststrokes':True,
|
||||||
|
'notes':'Some Notes 4',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|||||||
@@ -344,6 +344,8 @@ class FavoriteChart(models.Model):
|
|||||||
default='both',
|
default='both',
|
||||||
verbose_name='Workout Type')
|
verbose_name='Workout Type')
|
||||||
reststrokes = models.BooleanField(default=True,verbose_name="Incl. Rest")
|
reststrokes = models.BooleanField(default=True,verbose_name="Incl. Rest")
|
||||||
|
notes = models.CharField(max_length=300,verbose_name='Chart Notes',
|
||||||
|
default='Flex Chart Notes',blank=True)
|
||||||
user = models.ForeignKey(Rower)
|
user = models.ForeignKey(Rower)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %}
|
|
||||||
<div id="favorites" class="grid_12 alpha">
|
<div id="favorites" class="grid_12 alpha">
|
||||||
<div class="grid_2 suffix_4 alpha">
|
<div class="grid_2 suffix_4 alpha">
|
||||||
{% if maxfav >= 0 %}
|
{% if maxfav >= 0 %}
|
||||||
@@ -204,7 +203,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endlocaltime %}
|
{% endlocaltime %}
|
||||||
|
|||||||
@@ -151,7 +151,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %}
|
|
||||||
<div id="favorites" class="grid_12 alpha">
|
<div id="favorites" class="grid_12 alpha">
|
||||||
<div class="grid_2 suffix_4 alpha">
|
<div class="grid_2 suffix_4 alpha">
|
||||||
{% if maxfav >= 0 %}
|
{% if maxfav >= 0 %}
|
||||||
@@ -187,7 +186,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endlocaltime %}
|
{% endlocaltime %}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ from rowers.models import (
|
|||||||
WorkoutComment,WorkoutCommentForm,RowerExportForm,
|
WorkoutComment,WorkoutCommentForm,RowerExportForm,
|
||||||
)
|
)
|
||||||
from rowers.models import FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement
|
from rowers.models import FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement
|
||||||
from rowers.metrics import rowingmetrics
|
from rowers.metrics import rowingmetrics,defaultfavoritecharts
|
||||||
import rowers.uploads as uploads
|
import rowers.uploads as uploads
|
||||||
from django.forms.formsets import formset_factory
|
from django.forms.formsets import formset_factory
|
||||||
import StringIO
|
import StringIO
|
||||||
@@ -324,6 +324,22 @@ def ispromember(user):
|
|||||||
result = False
|
result = False
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
# More User/Rower utils
|
||||||
|
def add_defaultfavorites(r):
|
||||||
|
for c in defaultfavoritecharts:
|
||||||
|
f = FavoriteChart(user=r,
|
||||||
|
yparam1=c['yparam1'],
|
||||||
|
yparam2=c['yparam2'],
|
||||||
|
xparam=c['xparam'],
|
||||||
|
plottype=c['plottype'],
|
||||||
|
workouttype=c['workouttype'],
|
||||||
|
reststrokes=c['reststrokes'],
|
||||||
|
notes=c['notes'])
|
||||||
|
|
||||||
|
f.save()
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
# User registration
|
# User registration
|
||||||
def rower_register_view(request):
|
def rower_register_view(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
@@ -344,6 +360,9 @@ def rower_register_view(request):
|
|||||||
|
|
||||||
therower.save()
|
therower.save()
|
||||||
|
|
||||||
|
# create default favorite charts
|
||||||
|
add_defaultfavorites(therower)
|
||||||
|
|
||||||
# Create Sample workout
|
# Create Sample workout
|
||||||
f = 'media/testdata.csv.gz'
|
f = 'media/testdata.csv.gz'
|
||||||
timestr = strftime("%Y%m%d-%H%M%S")
|
timestr = strftime("%Y%m%d-%H%M%S")
|
||||||
@@ -8258,7 +8277,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
|||||||
})
|
})
|
||||||
|
|
||||||
# Page where user can manage his favorite charts
|
# Page where user can manage his favorite charts
|
||||||
@user_passes_test(ispromember,login_url="/rowers/me/edit",redirect_field_name=None)
|
@login_required()
|
||||||
def rower_favoritecharts_view(request):
|
def rower_favoritecharts_view(request):
|
||||||
message = ''
|
message = ''
|
||||||
successmessage = ''
|
successmessage = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user