Private
Public Access
1
0

zip file now with enumerated workout title

This commit is contained in:
Sander Roosendaal
2017-11-07 16:09:37 +01:00
parent ae3ce88baf
commit 9561245756
3 changed files with 32 additions and 10 deletions

View File

@@ -8,6 +8,8 @@ from rowingdata import rowingdata as rrdata
from rowingdata import rower as rrower
from shutil import copyfile
from rowingdata import get_file_type, get_empower_rigging
from rowers.tasks import handle_sendemail_unrecognized
@@ -17,6 +19,7 @@ from pandas import DataFrame, Series
from django.utils import timezone
from django.utils.timezone import get_current_timezone
from django_mailbox.models import Message,Mailbox,MessageAttachment
from time import strftime
import arrow
@@ -975,14 +978,24 @@ def new_workout_from_file(r, f2,
inboard = 0.88
if len(fileformat) == 3 and fileformat[0] == 'zip':
f_to_be_deleted = f2
title = os.path.basename(f2)
res = myqueue(
queuelow,
handle_zip_file,
r.user.email,
title,
f2
)
workoutsbox = Mailbox.objects.filter(name='workouts')[0]
msg = Message(mailbox=workoutsbox,
from_header=r.user.email,
subject = title)
msg.save()
f3 = 'media/mailbox_attachments/'+f2[6:]
copyfile(f2,f3)
f3 = f3[6:]
a = MessageAttachment(message=msg,document=f3)
a.save()
# res = myqueue(
# queuelow,
# handle_zip_file,
# r.user.email,
# title,
# f2
# )
return -1, message, f2