added option to switch off fast calc
This commit is contained in:
@@ -875,9 +875,11 @@ class WorkoutForm(ModelForm):
|
|||||||
|
|
||||||
# Used for the rowing physics calculations
|
# Used for the rowing physics calculations
|
||||||
class AdvancedWorkoutForm(ModelForm):
|
class AdvancedWorkoutForm(ModelForm):
|
||||||
|
quick_calc = forms.BooleanField(initial=True,required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Workout
|
model = Workout
|
||||||
fields = ['boattype','weightvalue']
|
fields = ['boattype','weightvalue','quick_calc']
|
||||||
|
|
||||||
class RowerExportForm(ModelForm):
|
class RowerExportForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -356,10 +356,7 @@ def handle_sendemailcsv(first_name, last_name, email, csvfile,**kwargs):
|
|||||||
def handle_otwsetpower(self,f1, boattype, weightvalue,
|
def handle_otwsetpower(self,f1, boattype, weightvalue,
|
||||||
first_name, last_name, email, workoutid,
|
first_name, last_name, email, workoutid,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
# ps=[
|
|
||||||
# 1, 1, 1, 1],
|
|
||||||
# ratio=1.0,
|
|
||||||
# debug=False):
|
|
||||||
job = self.request
|
job = self.request
|
||||||
job_id = job.id
|
job_id = job.id
|
||||||
|
|
||||||
@@ -378,7 +375,12 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
|
|||||||
debug = kwargs['debug']
|
debug = kwargs['debug']
|
||||||
else:
|
else:
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
|
if 'quick_calc' in kwargs:
|
||||||
|
usetable = kwargs['quick_calc']
|
||||||
|
else:
|
||||||
|
usetable = False
|
||||||
|
|
||||||
kwargs['jobid'] = job_id
|
kwargs['jobid'] = job_id
|
||||||
|
|
||||||
|
|
||||||
@@ -416,8 +418,10 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
progressurl = SITE_URL
|
progressurl = SITE_URL
|
||||||
|
siteurl = SITE_URL
|
||||||
if debug:
|
if debug:
|
||||||
progressurl = SITE_URL_DEV
|
progressurl = SITE_URL_DEV
|
||||||
|
siteurl = SITE_URL_DEV
|
||||||
secret = PROGRESS_CACHE_SECRET
|
secret = PROGRESS_CACHE_SECRET
|
||||||
|
|
||||||
progressurl += "/rowers/record-progress/"
|
progressurl += "/rowers/record-progress/"
|
||||||
@@ -431,7 +435,7 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
|
|||||||
powermeasured=powermeasured,
|
powermeasured=powermeasured,
|
||||||
progressurl=progressurl,
|
progressurl=progressurl,
|
||||||
secret=secret,
|
secret=secret,
|
||||||
usetable=True,storetable=physics_cache,
|
usetable=usetable,storetable=physics_cache,
|
||||||
)
|
)
|
||||||
|
|
||||||
# save data
|
# save data
|
||||||
@@ -470,7 +474,8 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
|
|||||||
message += "Thank you for using rowsandall.com.\n\n"
|
message += "Thank you for using rowsandall.com.\n\n"
|
||||||
message += "Rowsandall OTW calculations have not been fully implemented yet.\n"
|
message += "Rowsandall OTW calculations have not been fully implemented yet.\n"
|
||||||
message += "We are now running an experimental version for debugging purposes. \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 += "Your wind/stream corrected plot is available here: "
|
||||||
|
message += siteurl+"/rowers/workout/"
|
||||||
message += str(workoutid)
|
message += str(workoutid)
|
||||||
message += "/interactiveotwplot\n\n"
|
message += "/interactiveotwplot\n\n"
|
||||||
message += "Please report any bugs/inconsistencies/unexpected results at rowsandall.slack.com or by reply to this email.\n\n"
|
message += "Please report any bugs/inconsistencies/unexpected results at rowsandall.slack.com or by reply to this email.\n\n"
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
We use FISA minimum boat weight and standard rigging for our calculations.
|
We use FISA minimum boat weight and standard rigging for our calculations.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>The Quick calculation option potentially speeds up the calculation,
|
||||||
|
at the cost of a slight reduction in accuracy. It is recommended
|
||||||
|
to keep this option selected.</p>
|
||||||
|
|
||||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||||
{% if form.errors %}
|
{% if form.errors %}
|
||||||
<p style="color: red;">
|
<p style="color: red;">
|
||||||
|
|||||||
@@ -6728,12 +6728,14 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
|
|||||||
form = AdvancedWorkoutForm(request.POST)
|
form = AdvancedWorkoutForm(request.POST)
|
||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
quick_calc = form.cleaned_data['quick_calc']
|
||||||
boattype = form.cleaned_data['boattype']
|
boattype = form.cleaned_data['boattype']
|
||||||
weightvalue = form.cleaned_data['weightvalue']
|
weightvalue = form.cleaned_data['weightvalue']
|
||||||
row.boattype = boattype
|
row.boattype = boattype
|
||||||
row.weightvalue = weightvalue
|
row.weightvalue = weightvalue
|
||||||
row.save()
|
row.save()
|
||||||
|
|
||||||
|
|
||||||
# load row data & create power/wind/bearing columns if not set
|
# load row data & create power/wind/bearing columns if not set
|
||||||
f1 = row.csvfilename
|
f1 = row.csvfilename
|
||||||
rowdata = rdata(f1)
|
rowdata = rdata(f1)
|
||||||
@@ -6770,7 +6772,9 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
|
|||||||
weightvalue,
|
weightvalue,
|
||||||
first_name,last_name,emailaddress,id,
|
first_name,last_name,emailaddress,id,
|
||||||
ps=[r.p0,r.p1,r.p2,r.p3],
|
ps=[r.p0,r.p1,r.p2,r.p3],
|
||||||
ratio=r.cpratio)
|
ratio=r.cpratio,
|
||||||
|
quick_calc = quick_calc,
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
request.session['async_tasks'] += [(job.id,'otwsetpower')]
|
request.session['async_tasks'] += [(job.id,'otwsetpower')]
|
||||||
|
|||||||
Reference in New Issue
Block a user