Private
Public Access
1
0

Merge branch 'release/v3.28'

This commit is contained in:
Sander Roosendaal
2017-07-03 15:56:45 +02:00
8 changed files with 37 additions and 9 deletions
+5 -1
View File
@@ -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)),
+1 -1
View File
@@ -816,7 +816,7 @@ def new_workout_from_df(r,df,
timestr = strftime("%Y%m%d-%H%M%S") timestr = strftime("%Y%m%d-%H%M%S")
csvfilename ='media/Fusion_'+timestr+'.csv' csvfilename ='media/df_'+timestr+'.csv'
df.rename(columns = columndict,inplace=True) df.rename(columns = columndict,inplace=True)
+2 -2
View File
@@ -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)
+1
View File
@@ -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'),
) )
+26 -3
View File
@@ -146,7 +146,7 @@ USER_LANGUAGE = 'en-US'
from interactiveplots import * from interactiveplots import *
# Define the API documentation # Define the API documentation
schema_view = get_swagger_view(title='Rowsandall API (Unstable)') schema_view = get_swagger_view(title='Rowsandall API')
# Custom error pages with Rowsandall headers # Custom error pages with Rowsandall headers
def error500_view(request): def error500_view(request):
@@ -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,
@@ -7985,6 +8000,9 @@ def strokedatajson(request,id):
# currently only returns a subset. # currently only returns a subset.
columns = ['spm','time','hr','pace','power','distance'] columns = ['spm','time','hr','pace','power','distance']
datadf = dataprep.getsmallrowdata_db(columns,ids=[id]) datadf = dataprep.getsmallrowdata_db(columns,ids=[id])
with open('media/apilog.log','a') as logfile:
logfile.write(str(timezone.now())+": ")
logfile.write(request.user.username+"(GET) \n")
return JSONResponse(datadf) return JSONResponse(datadf)
if request.method == 'POST': if request.method == 'POST':
@@ -8032,6 +8050,10 @@ def strokedatajson(request,id):
starttime = totimestamp(row.startdatetime)+time starttime = totimestamp(row.startdatetime)+time
unixtime = starttime+time unixtime = starttime+time
with open('media/apilog.log','a') as logfile:
logfile.write(starttime+": ")
logfile.write(request.user.username+"(POST) \r\n")
data = pd.DataFrame({'TimeStamp (sec)':unixtime, data = pd.DataFrame({'TimeStamp (sec)':unixtime,
' Horizontal (meters)': distance, ' Horizontal (meters)': distance,
@@ -8049,6 +8071,7 @@ def strokedatajson(request,id):
' ElapsedTime (sec)':time, ' ElapsedTime (sec)':time,
}) })
# Following part should be replaced with dataprep.new_workout_from_df
timestr = row.startdatetime.strftime("%Y%m%d-%H%M%S") timestr = row.startdatetime.strftime("%Y%m%d-%H%M%S")
csvfilename ='media/Import_'+timestr+'.csv' csvfilename ='media/Import_'+timestr+'.csv'
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -15,7 +15,7 @@
} }
.two { .two {
background-image: url("/static/img/landing2.jpg"); background-image: url("/static/img/landing1.jpg");
} }
.three { .three {
@@ -23,7 +23,7 @@
} }
.four { .four {
background-image: url("/static/img/landing1.jpg"); background-image: url("/static/img/landing8b.jpg");
} }
html { html {
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB