Private
Public Access
1
0

added option to switch off fast calc

This commit is contained in:
Sander Roosendaal
2018-01-01 15:01:32 +01:00
parent fae61e052a
commit 1604768ada
4 changed files with 24 additions and 9 deletions

View File

@@ -875,9 +875,11 @@ class WorkoutForm(ModelForm):
# Used for the rowing physics calculations
class AdvancedWorkoutForm(ModelForm):
quick_calc = forms.BooleanField(initial=True,required=False)
class Meta:
model = Workout
fields = ['boattype','weightvalue']
fields = ['boattype','weightvalue','quick_calc']
class RowerExportForm(ModelForm):
class Meta:

View File

@@ -356,10 +356,7 @@ def handle_sendemailcsv(first_name, last_name, email, csvfile,**kwargs):
def handle_otwsetpower(self,f1, boattype, weightvalue,
first_name, last_name, email, workoutid,
**kwargs):
# ps=[
# 1, 1, 1, 1],
# ratio=1.0,
# debug=False):
job = self.request
job_id = job.id
@@ -379,6 +376,11 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
else:
debug = False
if 'quick_calc' in kwargs:
usetable = kwargs['quick_calc']
else:
usetable = False
kwargs['jobid'] = job_id
@@ -416,8 +418,10 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
pass
progressurl = SITE_URL
siteurl = SITE_URL
if debug:
progressurl = SITE_URL_DEV
siteurl = SITE_URL_DEV
secret = PROGRESS_CACHE_SECRET
progressurl += "/rowers/record-progress/"
@@ -431,7 +435,7 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
powermeasured=powermeasured,
progressurl=progressurl,
secret=secret,
usetable=True,storetable=physics_cache,
usetable=usetable,storetable=physics_cache,
)
# save data
@@ -470,7 +474,8 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
message += "Thank you for using rowsandall.com.\n\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 += "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 += "/interactiveotwplot\n\n"
message += "Please report any bugs/inconsistencies/unexpected results at rowsandall.slack.com or by reply to this email.\n\n"

View File

@@ -35,6 +35,10 @@
We use FISA minimum boat weight and standard rigging for our calculations.
</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">
{% if form.errors %}
<p style="color: red;">

View File

@@ -6728,12 +6728,14 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
form = AdvancedWorkoutForm(request.POST)
if form.is_valid():
quick_calc = form.cleaned_data['quick_calc']
boattype = form.cleaned_data['boattype']
weightvalue = form.cleaned_data['weightvalue']
row.boattype = boattype
row.weightvalue = weightvalue
row.save()
# load row data & create power/wind/bearing columns if not set
f1 = row.csvfilename
rowdata = rdata(f1)
@@ -6770,7 +6772,9 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
weightvalue,
first_name,last_name,emailaddress,id,
ps=[r.p0,r.p1,r.p2,r.p3],
ratio=r.cpratio)
ratio=r.cpratio,
quick_calc = quick_calc,
)
try:
request.session['async_tasks'] += [(job.id,'otwsetpower')]