added coastal as type, made workouttype sticky
This commit is contained in:
@@ -247,8 +247,12 @@ def createc2workoutdata_as_splits(w):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
|
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
|
||||||
|
|
||||||
|
wtype = w.workouttype
|
||||||
|
if wtype in ('other','coastal'):
|
||||||
|
wtype = 'water'
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"type": w.workouttype,
|
"type": wtype,
|
||||||
"date": w.startdatetime.isoformat(),
|
"date": w.startdatetime.isoformat(),
|
||||||
"distance": int(w.distance),
|
"distance": int(w.distance),
|
||||||
"time": int(10*makeseconds(durationstr)),
|
"time": int(10*makeseconds(durationstr)),
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ class DocumentsForm(forms.Form):
|
|||||||
file = forms.FileField(required=True,
|
file = forms.FileField(required=True,
|
||||||
validators=[validate_file_extension])
|
validators=[validate_file_extension])
|
||||||
workouttype = forms.ChoiceField(required=True,
|
workouttype = forms.ChoiceField(required=True,
|
||||||
choices=Workout.workouttypes,
|
choices=Workout.workouttypes)
|
||||||
initial='rower')
|
# initial='rower')
|
||||||
notes = forms.CharField(required=False,
|
notes = forms.CharField(required=False,
|
||||||
widget=forms.Textarea)
|
widget=forms.Textarea)
|
||||||
|
|
||||||
|
|||||||
@@ -361,6 +361,7 @@ class Workout(models.Model):
|
|||||||
('slides','Indoor Rower on Slides'),
|
('slides','Indoor Rower on Slides'),
|
||||||
('paddle','Paddle Adapter'),
|
('paddle','Paddle Adapter'),
|
||||||
('snow','On-snow'),
|
('snow','On-snow'),
|
||||||
|
('coastal','Coastal'),
|
||||||
('other','Other'),
|
('other','Other'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -6658,6 +6658,9 @@ def workout_upload_view(request,
|
|||||||
'make_plot':False,
|
'make_plot':False,
|
||||||
'upload_to_C2':False,
|
'upload_to_C2':False,
|
||||||
'plottype':'timeplot',
|
'plottype':'timeplot',
|
||||||
|
},
|
||||||
|
docformoptions={
|
||||||
|
'workouttype':'rower',
|
||||||
}):
|
}):
|
||||||
|
|
||||||
if 'uploadoptions' in request.session:
|
if 'uploadoptions' in request.session:
|
||||||
@@ -6665,6 +6668,10 @@ def workout_upload_view(request,
|
|||||||
else:
|
else:
|
||||||
request.session['uploadoptions'] = uploadoptions
|
request.session['uploadoptions'] = uploadoptions
|
||||||
|
|
||||||
|
if 'docformoptions' in request.session:
|
||||||
|
docformoptions = request.session['docformoptions']
|
||||||
|
else:
|
||||||
|
request.session['docformoptions'] = docformoptions
|
||||||
|
|
||||||
try:
|
try:
|
||||||
makeprivate = uploadoptions['makeprivate']
|
makeprivate = uploadoptions['makeprivate']
|
||||||
@@ -6675,6 +6682,11 @@ def workout_upload_view(request,
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
make_plot = False
|
make_plot = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
workouttype = docformoptions['workouttype']
|
||||||
|
except KeyError:
|
||||||
|
workouttype = 'rower'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
plottype = uploadoptions['plottype']
|
plottype = uploadoptions['plottype']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -6719,7 +6731,10 @@ def workout_upload_view(request,
|
|||||||
res = handle_uploaded_file(f)
|
res = handle_uploaded_file(f)
|
||||||
t = form.cleaned_data['title']
|
t = form.cleaned_data['title']
|
||||||
workouttype = form.cleaned_data['workouttype']
|
workouttype = form.cleaned_data['workouttype']
|
||||||
|
request.session['docformoptions'] = {
|
||||||
|
'workouttype':workouttype,
|
||||||
|
}
|
||||||
|
|
||||||
notes = form.cleaned_data['notes']
|
notes = form.cleaned_data['notes']
|
||||||
|
|
||||||
if optionsform.is_valid():
|
if optionsform.is_valid():
|
||||||
@@ -6930,7 +6945,7 @@ def workout_upload_view(request,
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
form = DocumentsForm()
|
form = DocumentsForm(initial=docformoptions)
|
||||||
optionsform = UploadOptionsForm(initial=uploadoptions)
|
optionsform = UploadOptionsForm(initial=uploadoptions)
|
||||||
return render(request, 'document_form.html',
|
return render(request, 'document_form.html',
|
||||||
{'form':form,
|
{'form':form,
|
||||||
|
|||||||
Reference in New Issue
Block a user