From 5bf97235e9befe78f276b95aab7269f55d77fd5d Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@bioforsk.no>
Date: Tue, 25 Aug 2015 16:20:34 +0200
Subject: [PATCH] Minor sketching changes

---
 calculators/static/calculators/js/eil.js   |  6 +++---
 calculators/templates/calculators/eil.html | 17 +++++++++++------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/calculators/static/calculators/js/eil.js b/calculators/static/calculators/js/eil.js
index d738f277..2154ad94 100644
--- a/calculators/static/calculators/js/eil.js
+++ b/calculators/static/calculators/js/eil.js
@@ -28,19 +28,19 @@
  * @param C Control cost (purchase & application of pesticide: [monetary unit / area unit] (e.g. NOK/daa)
  * @param V market value of crop ([monetary unit / weight unit], e.g. NOK/tonn)
  * @param Yp yield potential, maximum yield per production unit [weight unit / area unit], e.g. tonn/daa
- * @param K pesticide efficacy, the proportion of pest population killed. Range 0-1 (1=100% killed)
+ * @param K pesticide efficacy, the percentage of pest population killed. Range 0-1 (1=100% killed)
  * @param D damage per pest, expressed as a percentage of crop yield loss per pest inidividual(?)
  */
 function calculateEIL(C,V,Yp,K,D)
 {
 	// From Pedigo et al (1986)
-	return C / (V * Yp * K * D);
+	return C / (V * Yp * (K/100) * D);
 }
 
 function renderResult(formId)
 {
 	var theForm = document.getElementById(formId);
-	var resultParameters = " = " + theForm["C"].value + " / (" + theForm["V"].value + " * " + theForm["Yp"].value + " * " + theForm["K"].value + " * " + theForm["D"].value + ")";
+	var resultParameters = " = " + theForm["C"].value + " / (" + theForm["V"].value + " * " + theForm["Yp"].value + " * (" + theForm["K"].value + "/100) * " + theForm["D"].value + ")";
 	var resultValue = calculateEIL(
 			theForm["C"].value,
 			theForm["V"].value,
diff --git a/calculators/templates/calculators/eil.html b/calculators/templates/calculators/eil.html
index bb1d2764..fb712949 100644
--- a/calculators/templates/calculators/eil.html
+++ b/calculators/templates/calculators/eil.html
@@ -30,17 +30,20 @@
 	<div class="row">
 		<div class="col-md-6">
 			<div class="form-group">
-				<label for="C">{% trans "Control cost" %}</label>
+				<label for="C">{% trans "Control cost" %} (C) [NOK/daa]</label> <br/>
+				(the cost of purchasing and applying the control action (insecticide), expressed as dollar amount per acre ($/acre).)
 				<input type="number" name="C" class="form-control" min="0" onblur="validateField(this);"/>
 				<span class="help-block" id="{{ form_id }}_C_validation"></span>
 			</div>
 			<div class="form-group">
-				<label for="V">{% trans "Market value" %}</label>
+				<label for="V">{% trans "Market value" %} (V) [NOK/kg]</label><br/>
+				the market value of peas or the contracted price per hundred-weight, expressed as the dollar amount per hundred-weight ($/cwt).
 				<input type="number" name="V" class="form-control" min="0" onblur="validateField(this);"/>
 				<span class="help-block" id="{{ form_id }}_V_validation"></span>
 			</div>
 			<div class="form-group">
-				<label for="Yp">{% trans "Yield potential" %}</label>
+				<label for="Yp">{% trans "Yield potential" %} (Yp) [kg/daa]</label><br/>
+				the maximum yield per production unit, expressed as hundred-weight per acre (cwt/acre), historical values are typically used for this expression.
 				<input type="number" name="Yp" class="form-control" min="0" onblur="validateField(this);"/>
 				<span class="help-block" id="{{ form_id }}_Yp_validation"></span>
 			</div>
@@ -51,12 +54,14 @@
 		<div class="col-md-6">
 			
 			<div class="form-group">
-				<label for="K">{% trans "Insecticide efficacy" %}</label>
+				<label for="K">{% trans "Insecticide efficacy" %} (K) [%]</label><br/>
+				the efficacy of any insecticide is the proportion of the pest population killed, it can range from 0 to 1 (typically it is expressed as 1, meaning 100% of the pest population is killed).
 				<input type="number" name="K" class="form-control" min="0" max="1" onblur="validateField(this);"/>
 				<span class="help-block" id="{{ form_id }}_K_validation"></span>
 			</div>
 			<div class="form-group">
-				<label for="D">{% trans "Damage per pest individual" %} (?)</label>
+				<label for="D">{% trans "Damage per pest individual" %} (?) (D) [kg/skadegjørermåleenhet]</label> <br/>
+				Damage per aphid, expressed as a percentage of crop yield loss per aphid during the start of flowering.
 				<input type="number" name="D" class="form-control" min="0" onblur="validateField(this);"/>
 				<span class="help-block" id="{{ form_id }}_D_validation"></span>
 			</div>
@@ -66,7 +71,7 @@
 	<div class="row">
 		<div class="col-md-12">
 			<div id="result" style="font-weight: bold;">
-				{% trans "Calculated EIL" %} = C / (V * Yp * D * K)<span id="resultParameters"></span>: <span id="resultValue"></span>
+				{% trans "Calculated EIL" %} = C / (V * Yp * D * (K/100))<span id="resultParameters"></span>: <span id="resultValue"></span>
 			</div>
 		</div>
 	</div>
-- 
GitLab