diff --git a/rowers/.#dataprep.py b/rowers/.#dataprep.py deleted file mode 100644 index 61086939..00000000 --- a/rowers/.#dataprep.py +++ /dev/null @@ -1 +0,0 @@ -E408191@CZ27LT9RCGN72.13020:1492098105 \ No newline at end of file diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 82878440..c648468d 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -573,26 +573,20 @@ def new_workout_from_file(r,f2, inboard = 0.88 if len(fileformat)==3 and fileformat[0]=='zip': f_to_be_deleted = f2 - with zipfile.ZipFile(f2) as z: - for fname in z.namelist(): - f3 = z.extract(fname,path='media/') - print f3,r.user.email,title - if settings.DEBUG: - res = handle_zip_file.delay( - r.user.email,title,f3 - ) + title = os.path.basename(f2) + if settings.DEBUG: + res = handle_zip_file.delay( + r.user.email,title,f2 + ) - else: - res = queuelow.enqueue( - handle_zip_file, - r.user.email, - title, - f3 - ) + else: + res = queuelow.enqueue( + handle_zip_file, + r.user.email, + title, + f2 + ) - - - os.remove(f_to_be_deleted) return -1,message,f2 # Some people try to upload Concept2 logbook summaries diff --git a/rowers/management/commands/processemail.py b/rowers/management/commands/processemail.py index 918602ec..53a755d7 100644 --- a/rowers/management/commands/processemail.py +++ b/rowers/management/commands/processemail.py @@ -63,12 +63,14 @@ class Command(BaseCommand): z = zipfile.ZipFile(a.document) for f in z.namelist(): f2 = z.extract(f,path='media/') + title = os.path.basename(f2) wid = [ - make_new_workout_from_email(rr,f2[6:],name) + make_new_workout_from_email(rr,f2[6:],title) ] res += wid link = 'http://rowsandall.com/rowers/workout/'+str(wid[0])+'/edit' - dd = send_confirm(rr.user,name,link) + dd = send_confirm(rr.user,title,link) + time.sleep(10) else: # move attachment and make workout diff --git a/rowers/tasks.py b/rowers/tasks.py index 137cc718..6f4a2a01 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -98,6 +98,7 @@ def handle_zip_file(emailfrom,subject,file): ['workouts@rowsandall.com']) email.attach_file(file) res = email.send() + time.sleep(60) return 1 # Send email with CSV attachment diff --git a/rowers/views.py b/rowers/views.py index 7e422794..c2eb66d7 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -5231,7 +5231,7 @@ def workout_upload_view(request,message="", response = HttpResponseRedirect(url) return response elif id == -1: - message = 'Zip files will be processed in the background' + message = 'The zip archive will be processed in the background. The files in the archive will only be uploaded without the extra actions. You will receive email when the workouts are ready.' url = reverse(workout_upload_view, args=[str(message)]) response = HttpResponseRedirect(url)