Private
Public Access
1
0

processes files > 1 MB offline

This commit is contained in:
Sander Roosendaal
2017-11-02 15:53:54 +01:00
parent c871d69097
commit c974927192
6 changed files with 129 additions and 29 deletions

View File

@@ -101,7 +101,8 @@ from rowers.tasks import handle_makeplot,handle_otwsetpower,handle_sendemailtcx,
from rowers.tasks import (
handle_sendemail_unrecognized,handle_sendemailnewcomment,
handle_sendemailnewresponse, handle_updatedps,
handle_updatecp,long_test_task,long_test_task2
handle_updatecp,long_test_task,long_test_task2,
handle_zip_file
)
from scipy.signal import savgol_filter
@@ -8244,6 +8245,7 @@ def workout_upload_view(request,
}
notes = form.cleaned_data['notes']
offline = form.cleaned_data['offline']
if optionsform.is_valid():
make_plot = optionsform.cleaned_data['make_plot']
@@ -8276,12 +8278,29 @@ def workout_upload_view(request,
f1 = res[0] # file name
f2 = res[1] # file name incl media directory
id,message,f2 = dataprep.new_workout_from_file(r,f2,
workouttype=workouttype,
makeprivate=makeprivate,
title = t,
notes='')
if not offline:
id,message,f2 = dataprep.new_workout_from_file(
r,f2,
workouttype=workouttype,
makeprivate=makeprivate,
title = t,
notes=''
)
else:
job = myqueue(
queuehigh,
handle_zip_file,
r.user.email,
t,
f2)
messages.info(
request,
"The file was too large to process in real time. It will be processed in a background process. You will receive an email when it is ready")
url = reverse(workout_upload_view)
response = HttpResponseRedirect(url)
return response
if not id:
messages.error(request,message)
url = reverse(workout_upload_view)
@@ -8450,6 +8469,7 @@ def team_workout_upload_view(request,message="",
f = request.FILES['file']
res = handle_uploaded_file(f)
t = form.cleaned_data['title']
offline = form.cleaned_data['offline']
if rowerform.is_valid():
u = rowerform.cleaned_data['user']
if u:
@@ -8490,11 +8510,33 @@ def team_workout_upload_view(request,message="",
f2 = res[1] # file name incl media directory
id,message,f2 = dataprep.new_workout_from_file(r,f2,
workouttype=workouttype,
makeprivate=False,
title = t,
notes='')
if not offline:
id,message,f2 = dataprep.new_workout_from_file(
r,f2,
workouttype=workouttype,
makeprivate=False,
title = t,
notes=''
)
else:
job = myqueue(
queuehigh,
handle_zip_file,
r.user.email,
t,
f2)
messages.info(
request,
"The file was too large to process in real time. It will be processed in a background process. The user will receive an email when it is ready"
)
url = reverse(team_workout_upload_view)
response = HttpResponseRedirect(url)
return response
if not id:
messages.error(request,message)
url = reverse(team_workout_upload_view)