unfinished business
Need to create a post_progress view taking progress and job id as a POST parameter so that we can send the entire url to rowingdata
This commit is contained in:
@@ -16,7 +16,9 @@ from matplotlib.backends.backend_agg import FigureCanvas
|
||||
#from matplotlib.backends.backend_cairo import FigureCanvasCairo as FigureCanvas
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
from rowsandall_app.settings import SITE_URL
|
||||
from rowsandall_app.settings_dev import SITE_URL as SITE_URL_DEV
|
||||
from rowsandall_app.settings import PROGRESS_CACHE_SECRET
|
||||
|
||||
import pandas as pd
|
||||
|
||||
@@ -296,11 +298,17 @@ def handle_sendemailtcx(first_name, last_name, email, tcxfile,debug=False):
|
||||
@app.task
|
||||
def handle_zip_file(emailfrom, subject, file,debug=False):
|
||||
message = "... zip processing ... "
|
||||
if debug:
|
||||
print message
|
||||
email = EmailMessage(subject, message,
|
||||
emailfrom,
|
||||
['workouts@rowsandall.com'])
|
||||
email.attach_file(file)
|
||||
if debug:
|
||||
print "attaching"
|
||||
res = email.send()
|
||||
if debug:
|
||||
print "sent"
|
||||
time.sleep(60)
|
||||
return 1
|
||||
|
||||
@@ -338,12 +346,23 @@ def handle_sendemailcsv(first_name, last_name, email, csvfile,debug=False):
|
||||
# Calculate wind and stream corrections for OTW rowing
|
||||
|
||||
|
||||
@app.task
|
||||
@app.task(bind=True)
|
||||
def handle_otwsetpower(f1, boattype, weightvalue,
|
||||
first_name, last_name, email, workoutid, ps=[
|
||||
1, 1, 1, 1],
|
||||
ratio=1.0,
|
||||
debug=False):
|
||||
first_name, last_name, email, workoutid,
|
||||
**kwargs):
|
||||
# ps=[
|
||||
# 1, 1, 1, 1],
|
||||
# ratio=1.0,
|
||||
# debug=False):
|
||||
job = self.request
|
||||
job_id = job.id
|
||||
|
||||
if 'jobkey' in kwargs:
|
||||
job_id = kwargs.pop('jobkey')
|
||||
|
||||
kwargs['jobid'] = job_id
|
||||
|
||||
|
||||
try:
|
||||
rowdata = rdata(f1)
|
||||
except IOError:
|
||||
@@ -377,8 +396,19 @@ def handle_otwsetpower(f1, boattype, weightvalue,
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
progressurl = SITE_URL
|
||||
if debug:
|
||||
progressurl = SITE_URL_DEV
|
||||
secret = PROGRESS_CACHE_SECRET
|
||||
|
||||
progressurl += "/rowers/record-progress/"
|
||||
progressurl += str(progress)+"/"+jobid
|
||||
|
||||
rowdata.otw_setpower_silent(skiprows=5, mc=weightvalue, rg=rg,
|
||||
powermeasured=powermeasured)
|
||||
powermeasured=powermeasured,
|
||||
progressurl=progressurl,
|
||||
secret=secret
|
||||
)
|
||||
|
||||
# save data
|
||||
rowdata.write_csv(f1, gzip=True)
|
||||
|
||||
Reference in New Issue
Block a user