small refinement upload
This commit is contained in:
@@ -114,10 +114,10 @@ class Command(BaseCommand):
|
||||
extension = attachment.document.name[-3:].lower()
|
||||
try:
|
||||
message = Message.objects.get(id=attachment.message_id)
|
||||
if message.text:
|
||||
body = "\n".join(message.text.splitlines())
|
||||
else:
|
||||
body = message.body
|
||||
#if message.text:
|
||||
# body = "\n".join(message.text.splitlines())
|
||||
#else:
|
||||
body = message.get_body()
|
||||
|
||||
uploadoptions = uploads.upload_options(body)
|
||||
from_address = message.from_address[0].lower()
|
||||
|
||||
@@ -34,7 +34,7 @@ except:
|
||||
|
||||
from rowers.utils import (
|
||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||
str2bool,range_to_color_hex,absolute
|
||||
str2bool,range_to_color_hex,absolute,myqueue
|
||||
)
|
||||
|
||||
def cleanbody(body):
|
||||
@@ -51,10 +51,16 @@ def cleanbody(body):
|
||||
# currently only matches one chart
|
||||
def matchchart(line):
|
||||
results = []
|
||||
tester = VerEx().start_of_line().find('chart').OR().find('plot')
|
||||
tester2 = VerEx().start_of_line().find('chart').OR().find('plot').anything().find('distance')
|
||||
tester3 = VerEx().start_of_line().find('chart').OR().find('plot').anything().find('time')
|
||||
tester4 = VerEx().start_of_line().find('chart').OR().find('plot').anything().find('pie')
|
||||
testert = '^((chart)|(plot))'
|
||||
tester2t = testert+'(.*)(dist)'
|
||||
tester3t = testert+'(.*)(time)'
|
||||
tester4t = testert+'(.*)(pie)'
|
||||
|
||||
tester = re.compile(testert)
|
||||
tester2 = re.compile(tester2t)
|
||||
tester3 = re.compile(tester3t)
|
||||
tester4 = re.compile(tester4t)
|
||||
|
||||
if tester.match(line.lower()):
|
||||
if tester2.match(line.lower()):
|
||||
return 'distanceplot'
|
||||
@@ -262,15 +268,10 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
||||
if w.workouttype in ('water','coastal'):
|
||||
plotnr = plotnr+3
|
||||
|
||||
|
||||
if settings.DEBUG:
|
||||
job = handle_makeplot.delay(f1,f2,title,
|
||||
hrpwrdata,plotnr,
|
||||
imagename)
|
||||
else:
|
||||
job = queue.enqueue(handle_makeplot,f1,f2,
|
||||
title,hrpwrdata,
|
||||
plotnr,imagename)
|
||||
|
||||
job = myqueue(queue,handle_makeplot,f1,f2,
|
||||
title,hrpwrdata,
|
||||
plotnr,imagename)
|
||||
|
||||
try:
|
||||
width,height = Image.open(fullpathimagename).size
|
||||
|
||||
@@ -8620,7 +8620,11 @@ def workout_upload_view(request,
|
||||
|
||||
r = getrower(request.user)
|
||||
if (make_plot):
|
||||
id = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||
res,jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||
try:
|
||||
request.session['async_tasks'] += [(jobid,'make_plot')]
|
||||
except KeyError:
|
||||
request.session['async_tasks'] = [(jobid,'make_plot')]
|
||||
|
||||
# upload to C2
|
||||
if (upload_to_c2):
|
||||
|
||||
Reference in New Issue
Block a user