hopefully completing types features
This commit is contained in:
@@ -1076,7 +1076,7 @@ def checkbreakthrough(w, r):
|
|||||||
|
|
||||||
# Processes painsled CSV file to database
|
# Processes painsled CSV file to database
|
||||||
def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||||
boattype='1x',
|
boattype='static',
|
||||||
adaptiveclass='None',
|
adaptiveclass='None',
|
||||||
weightcategory='hwt',
|
weightcategory='hwt',
|
||||||
dosummary=True, title='Workout',
|
dosummary=True, title='Workout',
|
||||||
@@ -1366,7 +1366,7 @@ def new_workout_from_file(r, f2,
|
|||||||
workouttype='rower',
|
workouttype='rower',
|
||||||
workoutsource=None,
|
workoutsource=None,
|
||||||
title='Workout',
|
title='Workout',
|
||||||
boattype='1x',
|
boattype='static',
|
||||||
rpe=-1,
|
rpe=-1,
|
||||||
makeprivate=False,
|
makeprivate=False,
|
||||||
startdatetime='',
|
startdatetime='',
|
||||||
@@ -1552,7 +1552,7 @@ def new_workout_from_file(r, f2,
|
|||||||
def new_workout_from_df(r, df,
|
def new_workout_from_df(r, df,
|
||||||
title='New Workout',
|
title='New Workout',
|
||||||
workoutsource='unknown',
|
workoutsource='unknown',
|
||||||
boattype='1x',
|
boattype='static',
|
||||||
workouttype='rower',
|
workouttype='rower',
|
||||||
parent=None,
|
parent=None,
|
||||||
workoutid='',
|
workoutid='',
|
||||||
|
|||||||
@@ -1120,7 +1120,7 @@ workouttypes = tuple(ww)
|
|||||||
|
|
||||||
class DataFrameColumnsForm(forms.Form):
|
class DataFrameColumnsForm(forms.Form):
|
||||||
cols = ['ftime', 'cumdist', 'fpace', 'spm',
|
cols = ['ftime', 'cumdist', 'fpace', 'spm',
|
||||||
'hr', 'power', 'driveenergy', 'drivelength', 'averageforce',
|
'hr', 'grpower', 'driveenergy', 'drivelength', 'averageforce',
|
||||||
'peakforce', 'distance', 'drivespeed', 'workoutstate',
|
'peakforce', 'distance', 'drivespeed', 'workoutstate',
|
||||||
'catch', 'finish', 'peakforceangle', 'wash', 'slip', 'rhythm',
|
'catch', 'finish', 'peakforceangle', 'wash', 'slip', 'rhythm',
|
||||||
'effectiveangle', 'totalangle', 'distanceperstroke', 'velo']
|
'effectiveangle', 'totalangle', 'distanceperstroke', 'velo']
|
||||||
@@ -1157,7 +1157,7 @@ class TrendFlexModalForm(forms.Form):
|
|||||||
modality = forms.ChoiceField(choices=workouttypes,
|
modality = forms.ChoiceField(choices=workouttypes,
|
||||||
label='Workout Type',
|
label='Workout Type',
|
||||||
initial='all')
|
initial='all')
|
||||||
waterboattype = forms.MultipleChoiceField(choices=boattypes,
|
waterboattype = forms.MultipleChoiceField(choices=boattypes+ergtypes,
|
||||||
label='Water Boat Type',
|
label='Water Boat Type',
|
||||||
initial=mytypes.waterboattype)
|
initial=mytypes.waterboattype)
|
||||||
|
|
||||||
|
|||||||
@@ -3569,6 +3569,11 @@ class Workout(models.Model):
|
|||||||
if self.timezone == 'tzutc()':
|
if self.timezone == 'tzutc()':
|
||||||
self.timezone = 'UTC' # pragma: no cover
|
self.timezone = 'UTC' # pragma: no cover
|
||||||
|
|
||||||
|
if self.workouttype in mytypes.otwtypes and self.boattype in mytypes.ergtypes:
|
||||||
|
self.boattype = '1x'
|
||||||
|
elif self.workouttype in mytypes.otetypes and self.boattype in mytypes.boattypes:
|
||||||
|
self.boattype = 'static'
|
||||||
|
|
||||||
super(Workout, self).save(*args, **kwargs)
|
super(Workout, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
@@ -340,8 +340,6 @@ otwtypes = (
|
|||||||
|
|
||||||
otetypes = (
|
otetypes = (
|
||||||
'rower',
|
'rower',
|
||||||
'dynamic',
|
|
||||||
'slides'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
rowtypes = (
|
rowtypes = (
|
||||||
|
|||||||
@@ -65,9 +65,33 @@
|
|||||||
deleteText: '<div><p> </p></div><div>remove</div>'
|
deleteText: '<div><p> </p></div><div>remove</div>'
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
var boattypes = {
|
||||||
|
'1x': '1x (single)',
|
||||||
|
'2x': '2x (double)',
|
||||||
|
'2x+': '2x+ (coxed double)',
|
||||||
|
'2-': '2- (pair)',
|
||||||
|
'2+': '2+ (coxed pair)',
|
||||||
|
'3x+': '3x+ (coxed triple)',
|
||||||
|
'3x-': '3x- (triple)',
|
||||||
|
'4x': '4x (quad)',
|
||||||
|
'4x+': '4x+ (coxed quad)',
|
||||||
|
'4-': '4- (four)',
|
||||||
|
'4+': '4+ (coxed four)',
|
||||||
|
'8+': '8+ (eight)',
|
||||||
|
'8x+': '8x+ (octuple scull)',
|
||||||
|
}
|
||||||
|
|
||||||
|
var ergtypes = {
|
||||||
|
'static': 'Concept2 static',
|
||||||
|
'dynamic': 'Concept2 dynamic',
|
||||||
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
$('#id_workouttype').on('change', function(){
|
$('#id_workouttype').on('change', function(){
|
||||||
if (
|
if (
|
||||||
$(this).val() == 'water'
|
$(this).val() == 'water'
|
||||||
@@ -75,16 +99,51 @@ $( document ).ready(function() {
|
|||||||
|| $(this).val() == 'c-boat'
|
|| $(this).val() == 'c-boat'
|
||||||
|| $(this).val() == 'churchboat'
|
|| $(this).val() == 'churchboat'
|
||||||
) {
|
) {
|
||||||
$('#id_boattype').toggle(true);
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(boattypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
} else {
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
) {
|
||||||
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$('#id_boattype').toggle(false);
|
$('#id_boattype').toggle(false);
|
||||||
$('#id_boattype').val('1x');
|
$('#id_boattype').val('1x');
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
|| $(this).val() == 'dynamic'
|
||||||
|
|| $(this).val() == 'slides'
|
||||||
|
) {
|
||||||
|
$('#id_dragfactor').toggle(true);
|
||||||
|
} else {
|
||||||
|
$('#id_dragfactor').toggle(false);
|
||||||
|
$('#id_dragfactor').val('0');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#id_workouttype').change();
|
$('#id_workouttype').change();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,34 @@
|
|||||||
addText: '<div> </div><div>add filter</div>',
|
addText: '<div> </div><div>add filter</div>',
|
||||||
deleteText: '<div><p> </p></div><div>remove</div>'
|
deleteText: '<div><p> </p></div><div>remove</div>'
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
var boattypes = {
|
||||||
|
'1x': '1x (single)',
|
||||||
|
'2x': '2x (double)',
|
||||||
|
'2x+': '2x+ (coxed double)',
|
||||||
|
'2-': '2- (pair)',
|
||||||
|
'2+': '2+ (coxed pair)',
|
||||||
|
'3x+': '3x+ (coxed triple)',
|
||||||
|
'3x-': '3x- (triple)',
|
||||||
|
'4x': '4x (quad)',
|
||||||
|
'4x+': '4x+ (coxed quad)',
|
||||||
|
'4-': '4- (four)',
|
||||||
|
'4+': '4+ (coxed four)',
|
||||||
|
'8+': '8+ (eight)',
|
||||||
|
'8x+': '8x+ (octuple scull)',
|
||||||
|
}
|
||||||
|
|
||||||
|
var ergtypes = {
|
||||||
|
'static': 'Concept2 static',
|
||||||
|
'dynamic': 'Concept2 dynamic',
|
||||||
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
$('#id_workouttype').on('change', function(){
|
$('#id_workouttype').on('change', function(){
|
||||||
if (
|
if (
|
||||||
$(this).val() == 'water'
|
$(this).val() == 'water'
|
||||||
@@ -73,16 +98,51 @@ $( document ).ready(function() {
|
|||||||
|| $(this).val() == 'c-boat'
|
|| $(this).val() == 'c-boat'
|
||||||
|| $(this).val() == 'churchboat'
|
|| $(this).val() == 'churchboat'
|
||||||
) {
|
) {
|
||||||
$('#id_boattype').toggle(true);
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(boattypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
} else {
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
) {
|
||||||
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$('#id_boattype').toggle(false);
|
$('#id_boattype').toggle(false);
|
||||||
$('#id_boattype').val('1x');
|
$('#id_boattype').val('1x');
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
|| $(this).val() == 'dynamic'
|
||||||
|
|| $(this).val() == 'slides'
|
||||||
|
) {
|
||||||
|
$('#id_dragfactor').toggle(true);
|
||||||
|
} else {
|
||||||
|
$('#id_dragfactor').toggle(false);
|
||||||
|
$('#id_dragfactor').val('0');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#id_workouttype').change();
|
$('#id_workouttype').change();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
<script type='text/javascript'
|
<script type='text/javascript'
|
||||||
src='https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js'>
|
src='https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js'>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
@@ -80,9 +78,34 @@
|
|||||||
|
|
||||||
{% 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>
|
<script>
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
var boattypes = {
|
||||||
|
'1x': '1x (single)',
|
||||||
|
'2x': '2x (double)',
|
||||||
|
'2x+': '2x+ (coxed double)',
|
||||||
|
'2-': '2- (pair)',
|
||||||
|
'2+': '2+ (coxed pair)',
|
||||||
|
'3x+': '3x+ (coxed triple)',
|
||||||
|
'3x-': '3x- (triple)',
|
||||||
|
'4x': '4x (quad)',
|
||||||
|
'4x+': '4x+ (coxed quad)',
|
||||||
|
'4-': '4- (four)',
|
||||||
|
'4+': '4+ (coxed four)',
|
||||||
|
'8+': '8+ (eight)',
|
||||||
|
'8x+': '8x+ (octuple scull)',
|
||||||
|
}
|
||||||
|
|
||||||
|
var ergtypes = {
|
||||||
|
'static': 'Concept2 static',
|
||||||
|
'dynamic': 'Concept2 dynamic',
|
||||||
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
$('#id_workouttype').on('change', function(){
|
$('#id_workouttype').on('change', function(){
|
||||||
if (
|
if (
|
||||||
$(this).val() == 'water'
|
$(this).val() == 'water'
|
||||||
@@ -90,18 +113,53 @@ $( document ).ready(function() {
|
|||||||
|| $(this).val() == 'c-boat'
|
|| $(this).val() == 'c-boat'
|
||||||
|| $(this).val() == 'churchboat'
|
|| $(this).val() == 'churchboat'
|
||||||
) {
|
) {
|
||||||
$('#id_boattype').toggle(true);
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(boattypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
} else {
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
) {
|
||||||
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$('#id_boattype').toggle(false);
|
$('#id_boattype').toggle(false);
|
||||||
$('#id_boattype').val('1x');
|
$('#id_boattype').val('1x');
|
||||||
}
|
}
|
||||||
});
|
if (
|
||||||
$('#id_workouttype').change();
|
$(this).val() == 'rower'
|
||||||
});
|
|| $(this).val() == 'dynamic'
|
||||||
|
|| $(this).val() == 'slides'
|
||||||
|
) {
|
||||||
|
$('#id_dragfactor').toggle(true);
|
||||||
|
} else {
|
||||||
|
$('#id_dragfactor').toggle(false);
|
||||||
|
$('#id_dragfactor').val('0');
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
});
|
||||||
|
$('#id_workouttype').change();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var td = new FormData();
|
var td = new FormData();
|
||||||
var formdatasetok = false;
|
var formdatasetok = false;
|
||||||
try {
|
try {
|
||||||
@@ -188,10 +246,10 @@ $('#id_workouttype').change();
|
|||||||
console.log("Set offline to True");
|
console.log("Set offline to True");
|
||||||
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.');
|
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.');
|
||||||
$('#extra_message').addClass('message');
|
$('#extra_message').addClass('message');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input').each(function( i ) {
|
$('input').each(function( i ) {
|
||||||
$(this).change(function() {
|
$(this).change(function() {
|
||||||
@@ -298,7 +356,7 @@ $('#id_workouttype').change();
|
|||||||
$('#extra_message').addClass('message');
|
$('#extra_message').addClass('message');
|
||||||
}
|
}
|
||||||
data.set("file",f);
|
data.set("file",f);
|
||||||
// data.append("file",f);
|
// data.append("file",f);
|
||||||
|
|
||||||
$("#id_file").replaceWith('<div id="id_file">'+files[0].name+' <a class="remove" href="javascript:void(0);"><b><font color="red">X</font></b></a></div>');
|
$("#id_file").replaceWith('<div id="id_file">'+files[0].name+' <a class="remove" href="javascript:void(0);"><b><font color="red">X</font></b></a></div>');
|
||||||
},
|
},
|
||||||
@@ -313,11 +371,11 @@ $('#id_workouttype').change();
|
|||||||
$(this).parent().replaceWith('<td><input id="id_file" name="file" type="file" /></td>');
|
$(this).parent().replaceWith('<td><input id="id_file" name="file" type="file" /></td>');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
{% include 'menu_workouts.html' %}
|
{% include 'menu_workouts.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -76,7 +76,32 @@
|
|||||||
|
|
||||||
<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>
|
<script>
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
var boattypes = {
|
||||||
|
'1x': '1x (single)',
|
||||||
|
'2x': '2x (double)',
|
||||||
|
'2x+': '2x+ (coxed double)',
|
||||||
|
'2-': '2- (pair)',
|
||||||
|
'2+': '2+ (coxed pair)',
|
||||||
|
'3x+': '3x+ (coxed triple)',
|
||||||
|
'3x-': '3x- (triple)',
|
||||||
|
'4x': '4x (quad)',
|
||||||
|
'4x+': '4x+ (coxed quad)',
|
||||||
|
'4-': '4- (four)',
|
||||||
|
'4+': '4+ (coxed four)',
|
||||||
|
'8+': '8+ (eight)',
|
||||||
|
'8x+': '8x+ (octuple scull)',
|
||||||
|
}
|
||||||
|
|
||||||
|
var ergtypes = {
|
||||||
|
'static': 'Concept2 static',
|
||||||
|
'dynamic': 'Concept2 dynamic',
|
||||||
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
$('#id_workouttype').on('change', function(){
|
$('#id_workouttype').on('change', function(){
|
||||||
if (
|
if (
|
||||||
$(this).val() == 'water'
|
$(this).val() == 'water'
|
||||||
@@ -84,14 +109,49 @@ $( document ).ready(function() {
|
|||||||
|| $(this).val() == 'c-boat'
|
|| $(this).val() == 'c-boat'
|
||||||
|| $(this).val() == 'churchboat'
|
|| $(this).val() == 'churchboat'
|
||||||
) {
|
) {
|
||||||
$('#id_boattype').toggle(true);
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(boattypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
} else {
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
) {
|
||||||
|
var $el = $('#id_boattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
$('#id_boattype').toggle(false);
|
$('#id_boattype').toggle(false);
|
||||||
$('#id_boattype').val('1x');
|
$('#id_boattype').val('1x');
|
||||||
}
|
}
|
||||||
});
|
if (
|
||||||
$('#id_workouttype').change();
|
$(this).val() == 'rower'
|
||||||
});
|
|| $(this).val() == 'dynamic'
|
||||||
|
|| $(this).val() == 'slides'
|
||||||
|
) {
|
||||||
|
$('#id_dragfactor').toggle(true);
|
||||||
|
} else {
|
||||||
|
$('#id_dragfactor').toggle(false);
|
||||||
|
$('#id_dragfactor').val('0');
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
});
|
||||||
|
$('#id_workouttype').change();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -16,50 +16,85 @@
|
|||||||
</script>
|
</script>
|
||||||
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$( document ).ready(function() {
|
||||||
|
var boattypes = {
|
||||||
|
'1x': '1x (single)',
|
||||||
|
'2x': '2x (double)',
|
||||||
|
'2x+': '2x+ (coxed double)',
|
||||||
|
'2-': '2- (pair)',
|
||||||
|
'2+': '2+ (coxed pair)',
|
||||||
|
'3x+': '3x+ (coxed triple)',
|
||||||
|
'3x-': '3x- (triple)',
|
||||||
|
'4x': '4x (quad)',
|
||||||
|
'4x+': '4x+ (coxed quad)',
|
||||||
|
'4-': '4- (four)',
|
||||||
|
'4+': '4+ (coxed four)',
|
||||||
|
'8+': '8+ (eight)',
|
||||||
|
'8x+': '8x+ (octuple scull)',
|
||||||
|
}
|
||||||
|
|
||||||
// Get the form fields and hidden div
|
var ergtypes = {
|
||||||
var modality = $("#id_modality");
|
'static': 'Concept2 static',
|
||||||
var hidden = $("#id_waterboattype");
|
'dynamic': 'Concept2 dynamic',
|
||||||
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#id_modality').on('change', function(){
|
||||||
// Hide the fields.
|
if (
|
||||||
// Use JS to do this in case the user doesn't have JS
|
$(this).val() == 'water'
|
||||||
// enabled.
|
|| $(this).val() == 'coastal'
|
||||||
|
|| $(this).val() == 'c-boat'
|
||||||
hidden.hide();
|
|| $(this).val() == 'churchboat'
|
||||||
|
) {
|
||||||
|
var $el = $('#id_waterboattype');
|
||||||
|
$el.empty();
|
||||||
// Setup an event listener for when the state of the
|
$.each(boattypes, function(key,value) {
|
||||||
// checkbox changes.
|
if ( key == '{{ workout.boattype }}') {
|
||||||
modality.change(function() {
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
// Check to see if the checkbox is checked.
|
|
||||||
// If it is, show the fields and populate the input.
|
|
||||||
// If not, hide the fields.
|
|
||||||
var Value = modality.val();
|
|
||||||
if (Value=='water') {
|
|
||||||
// Show the hidden fields.
|
|
||||||
hidden.show();
|
|
||||||
} else {
|
} else {
|
||||||
// Make sure that the hidden fields are indeed
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
// hidden.
|
|
||||||
hidden.hide();
|
|
||||||
|
|
||||||
// You may also want to clear the value of the
|
|
||||||
// hidden fields here. Just in case somebody
|
|
||||||
// shows the fields, enters data to them and then
|
|
||||||
// unticks the checkbox.
|
|
||||||
//
|
|
||||||
// This would do the job:
|
|
||||||
//
|
|
||||||
// $("#hidden_field").val("");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
) {
|
||||||
|
var $el = $('#id_waterboattype');
|
||||||
|
$el.empty();
|
||||||
|
$.each(ergtypes, function(key,value) {
|
||||||
|
if ( key == '{{ workout.boattype }}') {
|
||||||
|
$el.append($("<option></option").attr("value", key).attr("selected", "selected").text(value));
|
||||||
|
} else {
|
||||||
|
$el.append($("<option></option").attr("value", key).text(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$el.toggle(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#id_waterboattype').toggle(false);
|
||||||
|
$('#id_waterboattype').val('1x');
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
$(this).val() == 'rower'
|
||||||
|
|| $(this).val() == 'dynamic'
|
||||||
|
|| $(this).val() == 'slides'
|
||||||
|
) {
|
||||||
|
$('#id_dragfactor').toggle(true);
|
||||||
|
} else {
|
||||||
|
$('#id_dragfactor').toggle(false);
|
||||||
|
$('#id_dragfactor').val('0');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
$('#id_modality').change();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
console.log('kill parents')
|
console.log('kill parents')
|
||||||
$("#id_killparents").change(function() {
|
$("#id_killparents").change(function() {
|
||||||
@@ -67,7 +102,7 @@ $(document).ready(function(){
|
|||||||
$("#id_killparentswarning").html("<p><em>Warning: Deleted workouts cannot be recovered</em></p>");
|
$("#id_killparentswarning").html("<p><em>Warning: Deleted workouts cannot be recovered</em></p>");
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
from rowers.mytypes import workouttypes, boattypes, otwtypes, workoutsources, workouttypes_ordered
|
from rowers.mytypes import workouttypes, boattypes, ergtypes, otwtypes, workoutsources, workouttypes_ordered
|
||||||
|
|
||||||
from rowers.rower_rules import is_promember
|
from rowers.rower_rules import is_promember
|
||||||
|
|
||||||
|
|||||||
@@ -1219,6 +1219,9 @@ def workouts_join_select(request,
|
|||||||
for b in mytypes.boattypes:
|
for b in mytypes.boattypes:
|
||||||
if b[0] not in waterboattype:
|
if b[0] not in waterboattype:
|
||||||
negtypes.append(b[0])
|
negtypes.append(b[0])
|
||||||
|
for b in mytypes.ergtypes:
|
||||||
|
if b[0] not in waterboattype: # pragma: no cover
|
||||||
|
negtypes.append(b[0])
|
||||||
|
|
||||||
startdate = datetime.datetime.combine(startdate, datetime.time())
|
startdate = datetime.datetime.combine(startdate, datetime.time())
|
||||||
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))
|
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))
|
||||||
|
|||||||
Reference in New Issue
Block a user