diff --git a/rowers/dataprep.py b/rowers/dataprep.py
index 8197c6d8..35a7ec9f 100644
--- a/rowers/dataprep.py
+++ b/rowers/dataprep.py
@@ -1076,7 +1076,7 @@ def checkbreakthrough(w, r):
# Processes painsled CSV file to database
def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
- boattype='1x',
+ boattype='static',
adaptiveclass='None',
weightcategory='hwt',
dosummary=True, title='Workout',
@@ -1366,7 +1366,7 @@ def new_workout_from_file(r, f2,
workouttype='rower',
workoutsource=None,
title='Workout',
- boattype='1x',
+ boattype='static',
rpe=-1,
makeprivate=False,
startdatetime='',
@@ -1552,7 +1552,7 @@ def new_workout_from_file(r, f2,
def new_workout_from_df(r, df,
title='New Workout',
workoutsource='unknown',
- boattype='1x',
+ boattype='static',
workouttype='rower',
parent=None,
workoutid='',
diff --git a/rowers/forms.py b/rowers/forms.py
index 8dce9f6d..bb29caa2 100644
--- a/rowers/forms.py
+++ b/rowers/forms.py
@@ -1111,6 +1111,7 @@ class PowerIntervalUpdateForm(forms.Form):
boattypes = mytypes.boattypes
+ergtypes = mytypes.ergtypes
workouttypes = mytypes.workouttypes
ww = list(workouttypes)
ww.append(tuple(('all', 'All')))
@@ -1119,7 +1120,7 @@ workouttypes = tuple(ww)
class DataFrameColumnsForm(forms.Form):
cols = ['ftime', 'cumdist', 'fpace', 'spm',
- 'hr', 'power', 'driveenergy', 'drivelength', 'averageforce',
+ 'hr', 'grpower', 'driveenergy', 'drivelength', 'averageforce',
'peakforce', 'distance', 'drivespeed', 'workoutstate',
'catch', 'finish', 'peakforceangle', 'wash', 'slip', 'rhythm',
'effectiveangle', 'totalangle', 'distanceperstroke', 'velo']
@@ -1143,7 +1144,7 @@ class AnalysisOptionsForm(forms.Form):
modality = forms.ChoiceField(choices=workouttypes,
label='Workout Type',
initial='all')
- waterboattype = forms.MultipleChoiceField(choices=boattypes,
+ waterboattype = forms.MultipleChoiceField(choices=boattypes+ergtypes,
label='Water Boat Type',
initial=mytypes.waterboattype)
@@ -1156,7 +1157,7 @@ class TrendFlexModalForm(forms.Form):
modality = forms.ChoiceField(choices=workouttypes,
label='Workout Type',
initial='all')
- waterboattype = forms.MultipleChoiceField(choices=boattypes,
+ waterboattype = forms.MultipleChoiceField(choices=boattypes+ergtypes,
label='Water Boat Type',
initial=mytypes.waterboattype)
diff --git a/rowers/models.py b/rowers/models.py
index 2aeb6ecb..20be9e6f 100644
--- a/rowers/models.py
+++ b/rowers/models.py
@@ -3443,6 +3443,7 @@ class PlannedSessionFormSmall(ModelForm):
boattypes = mytypes.boattypes
+ergtypes = mytypes.ergtypes
# Workout
rpechoices = (
@@ -3481,9 +3482,9 @@ class Workout(models.Model):
verbose_name='Exercise/Boat Class')
workoutsource = models.CharField(max_length=100,
default='unknown')
- boattype = models.CharField(choices=boattypes, max_length=50,
+ boattype = models.CharField(choices=boattypes+ergtypes, max_length=50,
default='1x',
- verbose_name='Boat Type')
+ verbose_name='Boat/Rower Type')
boatbrand = models.CharField(choices=boatbrands, max_length=50,
default='', verbose_name='Boat Brand')
adaptiveclass = models.CharField(choices=adaptivetypes, max_length=50,
@@ -3568,6 +3569,11 @@ class Workout(models.Model):
if self.timezone == 'tzutc()':
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)
def __str__(self):
@@ -3581,7 +3587,7 @@ class Workout(models.Model):
boattype = self.boattype
workouttype = self.workouttype
- if workouttype != 'water':
+ if workouttype not in ['water','rower']:
try:
stri = u'{d} {n} {dist}m {duration} {workouttype} {ownerfirst} {ownerlast}'.format(
d=date.strftime('%Y-%m-%d'),
diff --git a/rowers/mytypes.py b/rowers/mytypes.py
index 333c3a6a..fef3969d 100644
--- a/rowers/mytypes.py
+++ b/rowers/mytypes.py
@@ -8,8 +8,8 @@ workouttypes_ordered = collections.OrderedDict({
'rower': 'Indoor Rower',
'skierg': 'Ski Erg',
'bikeerg': 'Bike Erg',
- 'dynamic': 'Dynamic Indoor Rower',
- 'slides': 'Indoor Rower on Slides',
+# 'dynamic': 'Dynamic Indoor Rower',
+# 'slides': 'Indoor Rower on Slides',
'paddle': 'Paddle Adapter',
'snow': 'On-snow',
'coastal': 'Coastal',
@@ -340,8 +340,6 @@ otwtypes = (
otetypes = (
'rower',
- 'dynamic',
- 'slides'
)
rowtypes = (
@@ -432,6 +430,17 @@ boattypes = (
('8x+', '8x+ (octuple scull)'),
)
+ergtypes = (
+ ('static','Concept2 static'),
+ ('dynamic','Concept2 dynamic'),
+ ('slides', 'Concept2 slides'),
+ ('rp3','RP3'),
+ ('waterrower','Water Rower'),
+ ('other','Other Indoor Rower'),
+)
+
+
+
adaptivetypes = (
('None', 'Open'),
('PR1', 'PR1 (Arms and Shoulders)'),
diff --git a/rowers/sqlcode/boattypes.sql b/rowers/sqlcode/boattypes.sql
new file mode 100644
index 00000000..69abb226
--- /dev/null
+++ b/rowers/sqlcode/boattypes.sql
@@ -0,0 +1,4 @@
+UPDATE rowers_workout
+SET workouttype = 'rower', boattype = 'dynamic'
+WHERE workouttype = 'dynamic';
+
diff --git a/rowers/tasks.py b/rowers/tasks.py
index 25f2a03d..f767a22e 100644
--- a/rowers/tasks.py
+++ b/rowers/tasks.py
@@ -3354,8 +3354,8 @@ def handle_rp3_async_workout(userid, rp3token, rp3id, startdatetime, max_attempt
'secret': UPLOAD_SERVICE_SECRET,
'user': userid,
'file': filename,
- 'workouttype': 'dynamic',
- 'boattype': '1x',
+ 'workouttype': 'rower',
+ 'boattype': 'rp3',
'rp3id': int(rp3id),
'startdatetime': startdatetime,
'timezone': timezone,
@@ -3552,7 +3552,12 @@ def handle_c2_async_workout(alldata, userid, c2token, c2id, delaysec,
# rest_time = 0
distance = distance+rest_distance
c2id = data['id']
- workouttype = data['type']
+ if data['type'] in ['rower','dynamic','slides']:
+ workouttype = 'rower'
+ boattype = data['type']
+ else:
+ workouttype = data['type']
+ boattype = '1x'
# verified = data['verified']
# weightclass = data['weight_class']
@@ -3696,7 +3701,7 @@ def handle_c2_async_workout(alldata, userid, c2token, c2id, delaysec,
'file': csvfilename,
'title': title,
'workouttype': workouttype,
- 'boattype': '1x',
+ 'boattype': boattype,
'c2id': c2id,
'startdatetime': startdatetime.isoformat(),
'timezone': str(timezone)
diff --git a/rowers/templates/alert_create.html b/rowers/templates/alert_create.html
index 9940fa8e..3cb0b5bd 100644
--- a/rowers/templates/alert_create.html
+++ b/rowers/templates/alert_create.html
@@ -65,26 +65,85 @@
deleteText: '
remove
'
});
-
+ $('#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($("
{% endblock %}
diff --git a/rowers/templates/alert_edit.html b/rowers/templates/alert_edit.html
index 04f92ce2..d8712700 100644
--- a/rowers/templates/alert_edit.html
+++ b/rowers/templates/alert_edit.html
@@ -63,26 +63,86 @@
addText: '
add filter
',
deleteText: 'remove
'
});
-
+
+ $('#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($("
{% endblock %}
diff --git a/rowers/templates/document_form.html b/rowers/templates/document_form.html
index 85d7be01..dd591307 100644
--- a/rowers/templates/document_form.html
+++ b/rowers/templates/document_form.html
@@ -11,8 +11,6 @@
-
{% endblock %}
{% block main %}
@@ -80,244 +78,304 @@
{% block scripts %}
-
+
+ $('#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($("
-
- {% endblock %}
+ $('#id_offline').prop('checked','True');
+ data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked'));
+ 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').addClass('message');
+ }
+ data.set("file",f);
+ // data.append("file",f);
+
+ $("#id_file").replaceWith('');
+ },
+ mouseenter:function(){$("#id_drop-files").css("background-color","#E9E9E4");},
+ mouseleave:function(){$("#id_drop-files").css("background-color","#FFFFFF");},
+ dragover:function(e){
+ e.preventDefault();
+ $("#id_drop-files").css("background-color","#E9E9E4");},
+ dragleave:function(e){ e.preventDefault();},
+ });
+ $(document).on("click", "a.remove", function() {
+ $(this).parent().replaceWith(' | ');
+ });
+ });
+ };
+
+{% endblock %}
- {% block sidebar %}
- {% include 'menu_workouts.html' %}
- {% endblock %}
+{% block sidebar %}
+{% include 'menu_workouts.html' %}
+{% endblock %}
diff --git a/rowers/templates/manualadd.html b/rowers/templates/manualadd.html
index 0ec7f110..d196a191 100644
--- a/rowers/templates/manualadd.html
+++ b/rowers/templates/manualadd.html
@@ -14,21 +14,82 @@
{% endblock %}
diff --git a/rowers/templates/team_document_form.html b/rowers/templates/team_document_form.html
index 54260f6d..c011697e 100644
--- a/rowers/templates/team_document_form.html
+++ b/rowers/templates/team_document_form.html
@@ -76,22 +76,82 @@
+ $('#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($("
{% endblock %}
diff --git a/rowers/templates/user_analysis_select.html b/rowers/templates/user_analysis_select.html
index 935fe39d..dfc64a46 100644
--- a/rowers/templates/user_analysis_select.html
+++ b/rowers/templates/user_analysis_select.html
@@ -16,49 +16,105 @@
-
+
+ $('#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($("
{% endblock %}
{% block main %}
diff --git a/rowers/templates/workout_join_select.html b/rowers/templates/workout_join_select.html
index 4baa15d5..5b58836d 100644
--- a/rowers/templates/workout_join_select.html
+++ b/rowers/templates/workout_join_select.html
@@ -16,58 +16,93 @@
+
diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz
index a8f6a010..f3b37174 100644
Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ
diff --git a/rowers/uploads.py b/rowers/uploads.py
index 36b6ceac..781271f7 100644
--- a/rowers/uploads.py
+++ b/rowers/uploads.py
@@ -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
diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py
index cf41c4a3..38b7ec34 100644
--- a/rowers/views/analysisviews.py
+++ b/rowers/views/analysisviews.py
@@ -100,6 +100,11 @@ def analysis_new(request,
waterboattype = mytypes.waterboattype
+ try:
+ waterboattype = options['waterboattype']
+ except KeyError:
+ pass
+
if request.method == 'POST':
thediv = get_call()
dateform = DateRangeForm(request.POST)
@@ -122,7 +127,7 @@ def analysis_new(request,
modalities = [m[0] for m in mytypes.workouttypes]
else: # pragma: no cover
modalities = [modality]
- if modality != 'water':
+ if modality not in ['water','rower']:
waterboattype = [b[0] for b in mytypes.boattypes]
options['modalities'] = modalities
@@ -133,7 +138,7 @@ def analysis_new(request,
except KeyError:
worldclass = False
options['cpoverlay'] = worldclass
-
+
chartform = AnalysisChoiceForm(request.POST)
if chartform.is_valid():
options['form'] = chartform.cleaned_data
@@ -160,6 +165,9 @@ def analysis_new(request,
for b in mytypes.boattypes:
if b[0] not in waterboattype: # pragma: no cover
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())
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))
@@ -179,11 +187,6 @@ def analysis_new(request,
except (ValueError, AttributeError): # pragma: no cover
pass
- negtypes = []
- for b in mytypes.boattypes:
- if b[0] not in waterboattype: # pragma: no cover
- negtypes.append(b[0])
-
rankingtypes = [False,True]
if ranking:
rankingtypes = [True]
diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py
index 1b2705ac..e2134167 100644
--- a/rowers/views/workoutviews.py
+++ b/rowers/views/workoutviews.py
@@ -1219,6 +1219,9 @@ def workouts_join_select(request,
for b in mytypes.boattypes:
if b[0] not in waterboattype:
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())
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))