Merge branch 'release/v6.86'
This commit is contained in:
@@ -1495,7 +1495,8 @@ class Workout(models.Model):
|
|||||||
plannedsession = models.ForeignKey(PlannedSession, blank=True,null=True)
|
plannedsession = models.ForeignKey(PlannedSession, blank=True,null=True)
|
||||||
name = models.CharField(max_length=150)
|
name = models.CharField(max_length=150)
|
||||||
date = models.DateField()
|
date = models.DateField()
|
||||||
workouttype = models.CharField(choices=workouttypes,max_length=50)
|
workouttype = models.CharField(choices=workouttypes,max_length=50,
|
||||||
|
verbose_name='Exercise/Boat Class')
|
||||||
workoutsource = models.CharField(max_length=100,
|
workoutsource = models.CharField(max_length=100,
|
||||||
default='unknown')
|
default='unknown')
|
||||||
boattype = models.CharField(choices=boattypes,max_length=50,
|
boattype = models.CharField(choices=boattypes,max_length=50,
|
||||||
@@ -1508,7 +1509,11 @@ class Workout(models.Model):
|
|||||||
max_length=100)
|
max_length=100)
|
||||||
distance = models.IntegerField(default=0,blank=True)
|
distance = models.IntegerField(default=0,blank=True)
|
||||||
duration = models.TimeField(default=1,blank=True)
|
duration = models.TimeField(default=1,blank=True)
|
||||||
weightcategory = models.CharField(default="hwt",max_length=10,choices=weightcategories)
|
weightcategory = models.CharField(
|
||||||
|
default="hwt",
|
||||||
|
max_length=10,
|
||||||
|
choices=weightcategories,
|
||||||
|
verbose_name='Weight Category')
|
||||||
weightvalue = models.FloatField(default=80.0,blank=True,verbose_name = 'Average Crew Weight (kg)')
|
weightvalue = models.FloatField(default=80.0,blank=True,verbose_name = 'Average Crew Weight (kg)')
|
||||||
csvfilename = models.CharField(blank=True,max_length=150)
|
csvfilename = models.CharField(blank=True,max_length=150)
|
||||||
uploadedtoc2 = models.IntegerField(default=0)
|
uploadedtoc2 = models.IntegerField(default=0)
|
||||||
@@ -1794,7 +1799,7 @@ class WorkoutForm(ModelForm):
|
|||||||
# duration = forms.TimeInput(format='%H:%M:%S.%f')
|
# duration = forms.TimeInput(format='%H:%M:%S.%f')
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Workout
|
model = Workout
|
||||||
fields = ['name','date','starttime','timezone','duration','distance','workouttype','weightcategory','notes','privacy','rankingpiece','boattype']
|
fields = ['name','date','starttime','timezone','duration','distance','workouttype','boattype','weightcategory','notes','privacy','rankingpiece']
|
||||||
widgets = {
|
widgets = {
|
||||||
'date': AdminDateWidget(),
|
'date': AdminDateWidget(),
|
||||||
'notes': forms.Textarea,
|
'notes': forms.Textarea,
|
||||||
@@ -1806,7 +1811,7 @@ class WorkoutForm(ModelForm):
|
|||||||
# this line to be removed
|
# this line to be removed
|
||||||
del self.fields['privacy']
|
del self.fields['privacy']
|
||||||
|
|
||||||
if self.instance.workouttype != 'water':
|
if self.instance.workouttype not in types.otwtypes:
|
||||||
del self.fields['boattype']
|
del self.fields['boattype']
|
||||||
|
|
||||||
fieldorder = (
|
fieldorder = (
|
||||||
|
|||||||
@@ -145,6 +145,8 @@ def get_polar_notifications():
|
|||||||
|
|
||||||
return available_data
|
return available_data
|
||||||
|
|
||||||
|
from rowers.utils import isprorower
|
||||||
|
|
||||||
def get_all_new_workouts(available_data,testing=False):
|
def get_all_new_workouts(available_data,testing=False):
|
||||||
for record in available_data:
|
for record in available_data:
|
||||||
if testing:
|
if testing:
|
||||||
@@ -153,7 +155,7 @@ def get_all_new_workouts(available_data,testing=False):
|
|||||||
try:
|
try:
|
||||||
r = Rower.objects.get(polaruserid=record['user-id'])
|
r = Rower.objects.get(polaruserid=record['user-id'])
|
||||||
u = r.user
|
u = r.user
|
||||||
if r.polar_auto_import:
|
if r.polar_auto_import and isprorower(r):
|
||||||
exercise_list = get_polar_workouts(u)
|
exercise_list = get_polar_workouts(u)
|
||||||
if testing:
|
if testing:
|
||||||
print exercise_list
|
print exercise_list
|
||||||
|
|||||||
@@ -78,6 +78,28 @@
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$( document ).ready(function() {
|
||||||
|
$('#id_workouttype').on('change', function(){
|
||||||
|
if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
|| $(this).val() == 'skierg'
|
||||||
|
|| $(this).val() == 'dynamic'
|
||||||
|
|| $(this).val() == 'sliders'
|
||||||
|
|| $(this).val() == 'paddle'
|
||||||
|
|| $(this).val() == 'snow'
|
||||||
|
) {
|
||||||
|
$('#id_boattype').toggle(false);
|
||||||
|
$('#id_boattype').val('1x');
|
||||||
|
} else {
|
||||||
|
$('#id_boattype').toggle(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#id_workouttype').change();
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var td = new FormData();
|
var td = new FormData();
|
||||||
var formdatasetok = false;
|
var formdatasetok = false;
|
||||||
@@ -97,7 +119,7 @@
|
|||||||
|
|
||||||
if (formdatasetok) {
|
if (formdatasetok) {
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
|
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
|
||||||
console.log("CSRF token",csrftoken);
|
console.log("CSRF token",csrftoken);
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
|
|
||||||
<h2>Auto Import/Export Settings</h2>
|
<h2>Auto Import/Export Settings</h2>
|
||||||
|
|
||||||
|
|
||||||
<p>Use the form below to set your auto import/export settings.
|
<p>Use the form below to set your auto import/export settings.
|
||||||
As we implement auto import/export for various partner sites, this form will be expanded.</p>
|
As we implement auto import/export for various partner sites, this form will be expanded.</p>
|
||||||
|
|
||||||
@@ -112,6 +113,9 @@
|
|||||||
|
|
||||||
<p>Auto Export = New workouts uploaded to rowsandall.com will be automatically synchronized
|
<p>Auto Export = New workouts uploaded to rowsandall.com will be automatically synchronized
|
||||||
to the partner site</p>
|
to the partner site</p>
|
||||||
|
|
||||||
|
<p>These settings only have effect if you are a user on one
|
||||||
|
of the <a href="/rowers/promembership">paid plans</a></p>
|
||||||
|
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
<form id="importexportform" method="post">
|
<form id="importexportform" method="post">
|
||||||
@@ -124,6 +128,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -39,12 +39,19 @@
|
|||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Import, Export, Synchronization and download of all your data</td>
|
<td>Manual Import, Export, Synchronization and download of all your data</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Automatic Synchronization with other fitness sites</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>✔</td>
|
||||||
|
<td>✔</td>
|
||||||
|
<td>✔</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Heart rate and power zones</td>
|
<td>Heart rate and power zones</td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
workouttypes = (
|
workouttypes = (
|
||||||
('water','On-water - Olympic'),
|
('water','Standard Racing Shell'),
|
||||||
('rower','Indoor Rower'),
|
('rower','Indoor Rower'),
|
||||||
('skierg','Ski Erg'),
|
('skierg','Ski Erg'),
|
||||||
('dynamic','Dynamic Indoor Rower'),
|
('dynamic','Dynamic Indoor Rower'),
|
||||||
|
|||||||
@@ -373,15 +373,17 @@ def make_private(w,options):
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
from rowers.utils import isprorower
|
||||||
|
|
||||||
def do_sync(w,options):
|
def do_sync(w,options):
|
||||||
if ('upload_to_C2' in options and options['upload_to_C2']) or w.user.c2_auto_export:
|
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
||||||
except c2stuff.C2NoTokenError:
|
except c2stuff.C2NoTokenError:
|
||||||
id = 0
|
id = 0
|
||||||
message = "Something went wrong with the Concept2 sync"
|
message = "Something went wrong with the Concept2 sync"
|
||||||
|
|
||||||
if ('upload_to_Strava' in options and options['upload_to_Strava']) or w.user.strava_auto_export:
|
if ('upload_to_Strava' in options and options['upload_to_Strava']) or (w.user.strava_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = stravastuff.workout_strava_upload(
|
message,id = stravastuff.workout_strava_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
@@ -391,7 +393,7 @@ def do_sync(w,options):
|
|||||||
message = "Please connect to Strava first"
|
message = "Please connect to Strava first"
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or w.user.sporttracks_auto_export:
|
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
@@ -401,7 +403,7 @@ def do_sync(w,options):
|
|||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or w.user.runkeeper_auto_export:
|
if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = runkeeperstuff.workout_runkeeper_upload(
|
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
@@ -410,7 +412,7 @@ def do_sync(w,options):
|
|||||||
message = "Please connect to Runkeeper first"
|
message = "Please connect to Runkeeper first"
|
||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or w.user.mapmyfitness_auto_export:
|
if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = underarmourstuff.workout_ua_upload(
|
message,id = underarmourstuff.workout_ua_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
@@ -420,7 +422,7 @@ def do_sync(w,options):
|
|||||||
id = 0
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or w.user.trainingpeaks_auto_export:
|
if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = tpstuff.workout_tp_upload(
|
message,id = tpstuff.workout_tp_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
|
|||||||
@@ -369,3 +369,12 @@ def totaltime_sec_to_string(totaltime):
|
|||||||
duration = "%s:%s:%s.%s" % (hours, minutes, seconds, tenths)
|
duration = "%s:%s:%s.%s" % (hours, minutes, seconds, tenths)
|
||||||
|
|
||||||
return duration
|
return duration
|
||||||
|
|
||||||
|
def isprorower(r):
|
||||||
|
result = False
|
||||||
|
result = r.rowerplan in ['pro','coach','plan']
|
||||||
|
if not result and r.protrialexpires:
|
||||||
|
result = r.rowerplan is 'basic' and r.protrialexpires >= datetime.date.today()
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|||||||
@@ -926,6 +926,8 @@ def hasplannedsessions(user):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
from rowers.utils import isprorower
|
||||||
|
|
||||||
# Check if a user is a Pro member
|
# Check if a user is a Pro member
|
||||||
def ispromember(user):
|
def ispromember(user):
|
||||||
if not user.is_anonymous():
|
if not user.is_anonymous():
|
||||||
@@ -934,10 +936,8 @@ def ispromember(user):
|
|||||||
except Rower.DoesNotExists:
|
except Rower.DoesNotExists:
|
||||||
r = Rower(user=user)
|
r = Rower(user=user)
|
||||||
r.save()
|
r.save()
|
||||||
|
|
||||||
result = user.is_authenticated() and (r.rowerplan=='pro' or r.rowerplan=='coach' or r.rowerplan=='plan')
|
result = user.is_authenticated() and isprorower(r)
|
||||||
if not result and r.protrialexpires:
|
|
||||||
result = user.is_authenticated() and r.rowerplan=='basic' and r.protrialexpires >= datetime.date.today()
|
|
||||||
else:
|
else:
|
||||||
result = False
|
result = False
|
||||||
return result
|
return result
|
||||||
@@ -2684,9 +2684,6 @@ def imports_view(request):
|
|||||||
|
|
||||||
r.save()
|
r.save()
|
||||||
|
|
||||||
# polar_auto_import = cd['polar_auto_import']
|
|
||||||
# r.polar_auto_import = polar_auto_import
|
|
||||||
# r.save()
|
|
||||||
else:
|
else:
|
||||||
form = RowerImportExportForm(instance=r)
|
form = RowerImportExportForm(instance=r)
|
||||||
|
|
||||||
@@ -9195,6 +9192,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
|||||||
distance = form.cleaned_data['distance']
|
distance = form.cleaned_data['distance']
|
||||||
notes = form.cleaned_data['notes']
|
notes = form.cleaned_data['notes']
|
||||||
thetimezone = form.cleaned_data['timezone']
|
thetimezone = form.cleaned_data['timezone']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
boattype = request.POST['boattype']
|
boattype = request.POST['boattype']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -10516,7 +10514,7 @@ def workout_upload_view(request,
|
|||||||
request.session['async_tasks'] = [(jobid,'make_plot')]
|
request.session['async_tasks'] = [(jobid,'make_plot')]
|
||||||
|
|
||||||
# upload to C2
|
# upload to C2
|
||||||
if (upload_to_c2) or (w.user.c2_auto_export):
|
if (upload_to_c2) or (w.user.c2_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = c2stuff.workout_c2_upload(request.user,w)
|
message,id = c2stuff.workout_c2_upload(request.user,w)
|
||||||
except C2NoTokenError:
|
except C2NoTokenError:
|
||||||
@@ -10527,7 +10525,7 @@ def workout_upload_view(request,
|
|||||||
else:
|
else:
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|
||||||
if (upload_to_strava) or (w.user.strava_auto_export):
|
if (upload_to_strava) or (w.user.strava_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = stravastuff.workout_strava_upload(
|
message,id = stravastuff.workout_strava_upload(
|
||||||
request.user,w
|
request.user,w
|
||||||
@@ -10540,7 +10538,7 @@ def workout_upload_view(request,
|
|||||||
else:
|
else:
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|
||||||
if (upload_to_st) or (w.user.sporttracks_auto_export):
|
if (upload_to_st) or (w.user.sporttracks_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||||
request.user,w
|
request.user,w
|
||||||
@@ -10553,7 +10551,7 @@ def workout_upload_view(request,
|
|||||||
else:
|
else:
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|
||||||
if (upload_to_rk) or (w.user.runkeeper_auto_export):
|
if (upload_to_rk) or (w.user.runkeeper_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = runkeeperstuff.workout_runkeeper_upload(
|
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||||
request.user,w
|
request.user,w
|
||||||
@@ -10568,7 +10566,7 @@ def workout_upload_view(request,
|
|||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|
||||||
|
|
||||||
if (upload_to_ua) or (w.user.mapmyfitness_auto_export):
|
if (upload_to_ua) or (w.user.mapmyfitness_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = underarmourstuff.workout_ua_upload(
|
message,id = underarmourstuff.workout_ua_upload(
|
||||||
request.user,w
|
request.user,w
|
||||||
@@ -10583,7 +10581,7 @@ def workout_upload_view(request,
|
|||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|
||||||
|
|
||||||
if (upload_to_tp) or (w.user.trainingpeaks_auto_export):
|
if (upload_to_tp) or (w.user.trainingpeaks_auto_export and isprorower(w.user)):
|
||||||
try:
|
try:
|
||||||
message,id = tpstuff.workout_tp_upload(
|
message,id = tpstuff.workout_tp_upload(
|
||||||
request.user,w
|
request.user,w
|
||||||
|
|||||||
Reference in New Issue
Block a user