first form done (workout form)
This commit is contained in:
@@ -3443,6 +3443,7 @@ class PlannedSessionFormSmall(ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
boattypes = mytypes.boattypes
|
boattypes = mytypes.boattypes
|
||||||
|
ergtypes = mytypes.ergtypes
|
||||||
|
|
||||||
# Workout
|
# Workout
|
||||||
rpechoices = (
|
rpechoices = (
|
||||||
@@ -3481,9 +3482,9 @@ class Workout(models.Model):
|
|||||||
verbose_name='Exercise/Boat Class')
|
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+ergtypes, max_length=50,
|
||||||
default='1x',
|
default='1x',
|
||||||
verbose_name='Boat Type')
|
verbose_name='Boat/Rower Type')
|
||||||
boatbrand = models.CharField(choices=boatbrands, max_length=50,
|
boatbrand = models.CharField(choices=boatbrands, max_length=50,
|
||||||
default='', verbose_name='Boat Brand')
|
default='', verbose_name='Boat Brand')
|
||||||
adaptiveclass = models.CharField(choices=adaptivetypes, max_length=50,
|
adaptiveclass = models.CharField(choices=adaptivetypes, max_length=50,
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ workouttypes_ordered = collections.OrderedDict({
|
|||||||
'rower': 'Indoor Rower',
|
'rower': 'Indoor Rower',
|
||||||
'skierg': 'Ski Erg',
|
'skierg': 'Ski Erg',
|
||||||
'bikeerg': 'Bike Erg',
|
'bikeerg': 'Bike Erg',
|
||||||
'dynamic': 'Dynamic Indoor Rower',
|
# 'dynamic': 'Dynamic Indoor Rower',
|
||||||
'slides': 'Indoor Rower on Slides',
|
# 'slides': 'Indoor Rower on Slides',
|
||||||
'paddle': 'Paddle Adapter',
|
'paddle': 'Paddle Adapter',
|
||||||
'snow': 'On-snow',
|
'snow': 'On-snow',
|
||||||
'coastal': 'Coastal',
|
'coastal': 'Coastal',
|
||||||
@@ -432,6 +432,17 @@ boattypes = (
|
|||||||
('8x+', '8x+ (octuple scull)'),
|
('8x+', '8x+ (octuple scull)'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ergtypes = (
|
||||||
|
('static','Concept2 static'),
|
||||||
|
('dynamic','Concept2 dynamic'),
|
||||||
|
('slides', 'Concept2 slides'),
|
||||||
|
('rp3','RP3'),
|
||||||
|
('waterrower','Water Rower'),
|
||||||
|
('other','Other Indoor Rower'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
adaptivetypes = (
|
adaptivetypes = (
|
||||||
('None', 'Open'),
|
('None', 'Open'),
|
||||||
('PR1', 'PR1 (Arms and Shoulders)'),
|
('PR1', 'PR1 (Arms and Shoulders)'),
|
||||||
|
|||||||
@@ -24,36 +24,86 @@
|
|||||||
<script type='text/javascript'
|
<script type='text/javascript'
|
||||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
</script>
|
</script>
|
||||||
|
<script type='test/javascript' src='/static/js/boattypes.js'></script>
|
||||||
<script>
|
<script>
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
$('#id_workouttype').on('change', function(){
|
var boattypes = {
|
||||||
if (
|
'1x': '1x (single)',
|
||||||
$(this).val() == 'water'
|
'2x': '2x (double)',
|
||||||
|| $(this).val() == 'coastal'
|
'2x+': '2x+ (coxed double)',
|
||||||
|| $(this).val() == 'c-boat'
|
'2-': '2- (pair)',
|
||||||
|| $(this).val() == 'churchboat'
|
'2+': '2+ (coxed pair)',
|
||||||
) {
|
'3x+': '3x+ (coxed triple)',
|
||||||
$('#id_boattype').toggle(true);
|
'3x-': '3x- (triple)',
|
||||||
} else {
|
'4x': '4x (quad)',
|
||||||
$('#id_boattype').toggle(false);
|
'4x+': '4x+ (coxed quad)',
|
||||||
$('#id_boattype').val('1x');
|
'4-': '4- (four)',
|
||||||
}
|
'4+': '4+ (coxed four)',
|
||||||
if (
|
'8+': '8+ (eight)',
|
||||||
$(this).val() == 'rower'
|
'8x+': '8x+ (octuple scull)',
|
||||||
|| $(this).val() == 'dynamic'
|
}
|
||||||
|| $(this).val() == 'slides'
|
|
||||||
) {
|
|
||||||
$('#id_dragfactor').toggle(true);
|
|
||||||
} else {
|
|
||||||
$('#id_dragfactor').toggle(false);
|
|
||||||
$('#id_dragfactor').val('0');
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
var ergtypes = {
|
||||||
$('#id_workouttype').change();
|
'static': 'Concept2 static',
|
||||||
});
|
'dynamic': 'Concept2 dynamic',
|
||||||
</script>
|
'slides': 'Concept2 slides',
|
||||||
|
'rp3': 'RP3',
|
||||||
|
'waterrower': 'Water Rower',
|
||||||
|
'other': 'Other Indoor Rower',
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#id_workouttype').on('change', function(){
|
||||||
|
if (
|
||||||
|
$(this).val() == 'water'
|
||||||
|
|| $(this).val() == 'coastal'
|
||||||
|
|| $(this).val() == 'c-boat'
|
||||||
|
|| $(this).val() == 'churchboat'
|
||||||
|
) {
|
||||||
|
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 {
|
||||||
|
$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').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();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user