Added the use and calculation of wet hops. Assume 5.5 times more hops needed by weight.

Sun, 24 Feb 2019 22:29:00 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 24 Feb 2019 22:29:00 +0100
changeset 289
4082c41f45e9
parent 288
06dd071a429d
child 290
12aa92828e24

Added the use and calculation of wet hops. Assume 5.5 times more hops needed by weight.

www/includes/db_setup.php file | annotate | diff | comparison | revisions
www/includes/global.inc.php file | annotate | diff | comparison | revisions
www/js/global.js file | annotate | diff | comparison | revisions
www/js/profile_setup.js file | annotate | diff | comparison | revisions
www/prod_print.php file | annotate | diff | comparison | revisions
www/profile_setup.php file | annotate | diff | comparison | revisions
www/rec_print.php file | annotate | diff | comparison | revisions
--- a/www/includes/db_setup.php	Sun Feb 24 21:22:25 2019 +0100
+++ b/www/includes/db_setup.php	Sun Feb 24 22:29:00 2019 +0100
@@ -27,13 +27,14 @@
 	$sql .= "', factor_fwh='" . $_POST['factor_fwh'];
 	$sql .= "', factor_pellet='" . $_POST['factor_pellet'];
 	$sql .= "', factor_plug='" . $_POST['factor_plug'];
-	$sql .= "', color_method='" . mysqli_real_escape_string($connect, $_POST['color_method']);
-	$sql .= "', ibu_method='" . mysqli_real_escape_string($connect, $_POST['ibu_method']);
+	$sql .= "', factor_wethop='" . $_POST['factor_wethop'];
+	$sql .= "', color_method='" . $_POST['color_method'];
+	$sql .= "', ibu_method='" . $_POST['ibu_method'];
 	$sql .= "', brix_correction='" . $_POST['brix_correction'];
 	$sql .= "', grain_absorbtion='" . $_POST['grain_absorbtion'];
 	$sql .= "', default_water='" . $default_water;
 	$sql .= "' WHERE record='1';";
-//	syslog(LOG_NOTICE, $sql);
+	//syslog(LOG_NOTICE, $sql);
 	$result = mysqli_query($connect, $sql);
 	if (! $result) {
 		syslog(LOG_NOTICE, "db_profile_setup: ".$sql." result: ".mysqli_error($connect));
@@ -56,9 +57,10 @@
 		$data .= ',"factor_fwh":' . $row['factor_fwh'];
 		$data .= ',"factor_pellet":' . $row['factor_pellet'];
 		$data .= ',"factor_plug":' . $row['factor_plug'];
-		$data .= ',"ibu_method":"' . str_replace($escapers, $replacements, $row['ibu_method']);
-		$data .= '","color_method":"' . str_replace($escapers, $replacements, $row['color_method']);
-		$data .= '","brix_correction":' . floatval($row['brix_correction']);
+		$data .= ',"factor_wethop":' . $row['factor_wethop'];
+		$data .= ',"ibu_method":' . $row['ibu_method'];
+		$data .= ',"color_method":' . $row['color_method'];
+		$data .= ',"brix_correction":' . floatval($row['brix_correction']);
 		$data .= ',"grain_absorbtion":' . floatval($row['grain_absorbtion']);
 		$data .= ',"default_water":"' . str_replace($escapers, $replacements, $default_water);
 		$data .= '"}';
--- a/www/includes/global.inc.php	Sun Feb 24 21:22:25 2019 +0100
+++ b/www/includes/global.inc.php	Sun Feb 24 22:29:00 2019 +0100
@@ -62,7 +62,7 @@
 }
 mysqli_set_charset($connect, "utf8" );
 $my_default_water = $my_brewery_name = $my_ibu_method = $my_color_method = '';
-$my_factor_mashhop = $my_factor_fwh = $my_factor_pellet = $my_factor_plug = 0;
+$my_factor_mashhop = $my_factor_fwh = $my_factor_pellet = $my_factor_plug = $my_factor_wethop = 0;
 $my_brix_correction = $my_grain_absorbtion = 1.0;
 
 $result = mysqli_query($connect, "SELECT * FROM profile_setup WHERE record='1'") or die("SQL Error 1: " . mysqli_error($connect));
@@ -76,8 +76,9 @@
 	$my_factor_fwh= floatval($row['factor_fwh']);
 	$my_factor_pellet= floatval($row['factor_pellet']);
 	$my_factor_plug= floatval($row['factor_plug']);
-	$my_ibu_method = str_replace($escapers, $replacements, $row['ibu_method']);
-	$my_color_method = str_replace($escapers, $replacements, $row['color_method']);
+	$my_factor_wethop = floatval($row['factor_wethop']);
+	$my_ibu_method = $row['ibu_method'];
+	$my_color_method = $row['color_method'];
 	$my_brix_correction = floatval($row['brix_correction']);
 	$my_grain_absorbtion = floatval($row['grain_absorbtion']);
 }
@@ -97,6 +98,7 @@
 	global $my_factor_fwh;
 	global $my_factor_pellet;
 	global $my_factor_plug;
+	global $my_factor_wethop;
 	global $my_ibu_method;
 	global $my_color_method;
 	global $my_brix_correction;
@@ -124,6 +126,7 @@
 	var my_factor_fwh = "<?php echo $my_factor_fwh; ?>";
 	var my_factor_pellet = "<?php echo $my_factor_pellet; ?>";
 	var my_factor_plug = "<?php echo $my_factor_plug; ?>";
+	var my_factor_wethop = "<?php echo $my_factor_wethop; ?>";
 	var my_ibu_method = "<?php echo $my_ibu_method; ?>";
 	var my_color_method = "<?php echo $my_color_method; ?>";
 	var my_brix_correction = "<?php echo $my_brix_correction; ?>";
--- a/www/js/global.js	Sun Feb 24 21:22:25 2019 +0100
+++ b/www/js/global.js	Sun Feb 24 22:29:00 2019 +0100
@@ -114,10 +114,10 @@
 var HopTypeAdapter = new $.jqx.dataAdapter(HopTypeSource);
 
 var HopFormData = [
-	{ id: 0, en: 'Pellet', nl: 'pellets' },
-	{ id: 1, en: 'Plug',   nl: 'plugs' },
-	{ id: 2, en: 'Leaf',   nl: 'bellen' }
-//	{ id: 3, en: 'Leaf wet', nl: 'bellen nat' }
+	{ id: 0, en: 'Pellet',   nl: 'pellets' },
+	{ id: 1, en: 'Plug',     nl: 'plugs' },
+	{ id: 2, en: 'Leaf',     nl: 'bellen' },
+	{ id: 3, en: 'Leaf wet', nl: 'hop nat' }
 ];
 var HopFormSource = {
 	localdata: HopFormData,
@@ -698,55 +698,6 @@
 var mashlist = new $.jqx.dataAdapter(mashProfileSource);
 
 
-/*
-function getLocalization() {
-	var localizationobj = {};
-	localizationobj.pagerGoToPageString = "Gehe zu:";
-	localizationobj.pagerShowRowsString = "Zeige Zeile:";
-	localizationobj.pagerRangeString = " von ";
-	localizationobj.pagerNextButtonString = "voriger";
-	localizationobj.pagerFirstButtonString = "first";
-	localizationobj.pagerLastButtonString = "last";
-	localizationobj.pagerPreviousButtonString = "nächster";
-	localizationobj.sortAscendingString = "Sortiere aufsteigend";
-	localizationobj.sortDescendingString = "Sortiere absteigend";
-	localizationobj.sortRemoveString = "Entferne Sortierung";
-	localizationobj.firstDay = 1;
-	localizationobj.percentSymbol = "%";
-	localizationobj.currencySymbol = "€";
-	localizationobj.currencySymbolPosition = "after";
-	localizationobj.decimalSeparator = ",";
-	localizationobj.thousandsSeparator = ".";
-	var days = {
-		// full day names
-		names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
-		// abbreviated day names
-		namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"],
-		// shortest day names
-		namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
-	};
-	localizationobj.days = days;
-	var months = {
-		// full month names (13 months for lunar calendards -- 13th month should be "" if not lunar)
-		names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""],
-		// abbreviated month names
-		namesAbbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez", ""]
-	};
-	var patterns = {
-		d: "dd.MM.yyyy",
-		D: "dddd, d. MMMM yyyy",
-		t: "HH:mm",
-		T: "HH:mm:ss",
-		f: "dddd, d. MMMM yyyy HH:mm",
-		F: "dddd, d. MMMM yyyy HH:mm:ss",
-		M: "dd MMMM",
-		Y: "MMMM yyyy"
-	}
-	localizationobj.patterns = patterns;
-	localizationobj.months = months;
-	return localizationobj;
-}
-*/
 
 
 $(document).ready(function () {
@@ -848,9 +799,9 @@
 	if (Form == 1 ) {	// Plug
 		pfactor += my_factor_plug / 100;
 	}
-//	if (Form == 3) {	// Wet leaf
-//		pfactor += 5.5;	// From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
-//	}
+	if (Form == 3) {	// Wet leaf
+		pfactor += my_factor_wethop / 100;	// From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
+	}
 
 	if (Method == 0) {	// Tinseth
 		/* http://realbeer.com/hops/research.html */
--- a/www/js/profile_setup.js	Sun Feb 24 21:22:25 2019 +0100
+++ b/www/js/profile_setup.js	Sun Feb 24 22:29:00 2019 +0100
@@ -45,6 +45,7 @@
 	$("#factor_fwh").jqxTooltip({ content: 'Het efficientie percentage voor First Wort Hop.' });
 	$("#factor_pellet").jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop pellets.' });
 	$("#factor_plug").jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop plugs.' });
+	$("#factor_wethop").jqxTooltip({ content: 'Het efficientie percentage bij gebruik van nat geplukte hop.' });
 	$("#brix_correction").jqxTooltip({ content: 'Omzettingsfactor voor Plato naar Brix' });
 	$("#grain_absorbtion").jqxTooltip({ content: 'Absorbtie van water door graan (L/Kg)' });
 
@@ -59,6 +60,7 @@
 			{ name: 'factor_fwh', type: 'number' },
 			{ name: 'factor_pellet', type: 'number' },
 			{ name: 'factor_plug', type: 'number' },
+			{ name: 'factor_wethop', type: 'number' },
 			{ name: 'ibu_method', type: 'int' },
 			{ name: 'color_method', type: 'int' },
 			{ name: 'brix_correction', type: 'float' },
@@ -78,6 +80,7 @@
 			$("#factor_fwh").val(dataRecord.factor_fwh);
 			$("#factor_pellet").val(dataRecord.factor_pellet);
 			$("#factor_plug").val(dataRecord.factor_plug);
+			$("#factor_wethop").val(dataRecord.factor_wethop);
 			$("#color_method").val(dataRecord.color_method);
 			$("#ibu_method").val(dataRecord.ibu_method);
 			$("#brix_correction").val(dataRecord.brix_correction);
@@ -94,6 +97,7 @@
 	$("#factor_mashhop").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -50, max: 50, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right'  });
 	$("#factor_pellet").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right'  });
 	$("#factor_plug").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right'  });
+	$("#factor_wethop").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -98, max: -20, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right'  });
 	$("#brix_correction").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1.00, max: 1.05, decimalDigits: 2, spinButtons: true });
 	$("#grain_absorbtion").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.5, max: 1.1, decimalDigits: 2, spinButtons: true });
 	$("#color_method").jqxDropDownList({
@@ -134,6 +138,7 @@
 			factor_fwh: $("#factor_fwh").val(),
 			factor_pellet: $("#factor_pellet").val(),
 			factor_plug: $("#factor_plug").val(),
+			factor_wethop: $("#factor_wethop").val(),
 			color_method: $("#color_method").val(),
 			ibu_method: $("#ibu_method").val(),
 			brix_correction: parseFloat($("#brix_correction").jqxNumberInput('decimal')),
--- a/www/prod_print.php	Sun Feb 24 21:22:25 2019 +0100
+++ b/www/prod_print.php	Sun Feb 24 22:29:00 2019 +0100
@@ -191,7 +191,7 @@
 		global $total_ibus;
 		global $cost_hops;
 		global $preboil_sg;
-		$hopform = array( 'Pellets', 'Plugs', 'Bellen' );
+		$hopform = array( 'Pellets', 'Plugs', 'Bellen', 'Hop nat' );
 		$hopuse  = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' );
 		$vul = $this->w - $this->rMargin - $this->lMargin - 135;
 		$this->AddCol($vul,'Hop','L');
--- a/www/profile_setup.php	Sun Feb 24 21:22:25 2019 +0100
+++ b/www/profile_setup.php	Sun Feb 24 22:29:00 2019 +0100
@@ -35,13 +35,17 @@
        <td style="padding: 3px;"><div style="float: left;" id="ibu_method"></div></td>
       </tr>
       <tr>
-       <td style="vertical-align: top; float: right; padding: 3px;">Brix correctie factor:</td>
-       <td style="padding: 3px;"><div id="brix_correction"></div></td>
+       <td style="vertical-align: top; float: right; padding: 3px;">Wet hop factor:</td>
+       <td style="padding: 3px;"><div id="factor_wethop"></div></td>
        <td style="vertical-align: top; float: right; padding: 3px;">Graan absorbtie:</td>
        <td style="padding: 3px;"><div id="grain_absorbtion"></div></td>
        <td style="vertical-align: top; float: right; padding: 3px;">Standaard water:</td>
        <td style="padding: 3px;"><div style="float: left;" id="default_water"></div></td>
       </tr>
+      <tr>
+       <td style="vertical-align: top; float: right; padding: 3px;">Brix correctie factor:</td>
+       <td colspan="5" style="padding: 3px;"><div id="brix_correction"></div></td>
+      </tr>
      </table>
      <div style="float: right; margin-top: 330px; margin-bottom: 10px;">
       <input style="margin-right: 595px;" type="button" id="Save"   value="Sla op" />
--- a/www/rec_print.php	Sun Feb 24 21:22:25 2019 +0100
+++ b/www/rec_print.php	Sun Feb 24 22:29:00 2019 +0100
@@ -179,7 +179,7 @@
 		global $cost_hops;
 		global $preboil_sg;
 //		$hoptype = array( 'Bitterhop', 'Aromahop', 'Beide' );
-		$hopform = array( 'Pellets', 'Plugs', 'Bellen' );
+		$hopform = array( 'Pellets', 'Plugs', 'Bellen', 'Hop nat' );
 		$hopuse  = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' );
 		$vul = $this->w - $this->rMargin - $this->lMargin - 135;
 		$this->AddCol($vul,'Hop','L');

mercurial