rowing physics tasks to work with empower
This commit is contained in:
@@ -15,6 +15,8 @@ from matplotlib import figure
|
||||
|
||||
import stravalib
|
||||
|
||||
from rowers.dataprepnodjango import update_strokedata
|
||||
|
||||
from django.core.mail import send_mail, BadHeaderError,EmailMessage
|
||||
|
||||
|
||||
@@ -93,7 +95,9 @@ def handle_sendemailcsv(first_name,last_name,email,csvfile):
|
||||
return 1
|
||||
|
||||
@app.task
|
||||
def handle_otwsetpower(f1,boattype,weightvalue,first_name,last_name,email,workoutid):
|
||||
def handle_otwsetpower(f1,boattype,weightvalue,
|
||||
first_name,last_name,email,workoutid,
|
||||
debug=False):
|
||||
rowdata = rdata(f1)
|
||||
weightvalue = float(weightvalue)
|
||||
|
||||
@@ -112,11 +116,19 @@ def handle_otwsetpower(f1,boattype,weightvalue,first_name,last_name,email,workou
|
||||
rg = rowingdata.getrigging('static/rigging/1x.txt')
|
||||
|
||||
# do calculation
|
||||
rowdata.otw_setpower_silent(skiprows=5,mc=weightvalue,rg=rg)
|
||||
powermeasured = False
|
||||
try:
|
||||
w = rowdata.df['wash']
|
||||
powermeasured = True
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
rowdata.otw_setpower_silent(skiprows=5,mc=weightvalue,rg=rg,
|
||||
powermeasured=powermeasured)
|
||||
|
||||
# save data
|
||||
rowdata.write_csv(f1)
|
||||
dataprep.update_strokedata(workoutid,rowdata.df)
|
||||
update_strokedata(workoutid,rowdata.df,debug=debug)
|
||||
|
||||
# send email
|
||||
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
||||
@@ -128,7 +140,7 @@ def handle_otwsetpower(f1,boattype,weightvalue,first_name,last_name,email,workou
|
||||
message += "Rowsandall OTW calculations have not been fully implemented yet.\n"
|
||||
message += "We are now running an experimental version for debugging purposes. \n"
|
||||
message += "Your wind/stream corrected plot is available here: http://rowsandall.com/rowers/workout/"
|
||||
message += workoutid
|
||||
message += str(workoutid)
|
||||
message +="/interactiveotwplot\n\n"
|
||||
# message += "This functionality will be available soon, though.\n\n"
|
||||
message += "Please report any bugs/inconsistencies/unexpected results at rowsandall.slack.com or by reply to this email.\n\n"
|
||||
|
||||
Reference in New Issue
Block a user