In production archive lists show always the OG from the brew fermenter SG. Possible fix for the not used og field in the database.

Fri, 03 Jan 2020 15:21:22 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 03 Jan 2020 15:21:22 +0100
changeset 577
b4bfed3684d0
parent 576
8853fd62ac6f
child 578
e75ce5bbda73

In production archive lists show always the OG from the brew fermenter SG. Possible fix for the not used og field in the database.

www/includes/db_product.php file | annotate | diff | comparison | revisions
www/js/global.js file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/www/includes/db_product.php	Sun Dec 29 14:43:04 2019 +0100
+++ b/www/includes/db_product.php	Fri Jan 03 15:21:22 2020 +0100
@@ -563,7 +563,7 @@
 	}
 
 	if (isset($_GET['select']) && ($_GET['select'] == "archname")) {
-		$query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY name,brew_date_start;";
+		$query = "SELECT record,name,code,brew_date_start,st_name,brew_fermenter_sg,fg,batch_size FROM products WHERE stage = '11' ORDER BY name,brew_date_start;";
 		$result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
 		while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
 			$brews[] = array(
@@ -572,7 +572,7 @@
 				'code' => $row['code'],
 				'date' => substr($row['brew_date_start'], 0, 10),
 				'style' => $row['st_name'],
-				'og' => $row['og'],
+				'og' => $row['brew_fermenter_sg'],
 				'fg' => $row['fg'],
 				'batch_size' => $row['batch_size']
 			);
@@ -583,7 +583,7 @@
 	}
 
 	if (isset($_GET['select']) && ($_GET['select'] == "archcode")) {
-		$query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY code;";
+		$query = "SELECT record,name,code,brew_date_start,st_name,brew_fermenter_sg,fg,batch_size FROM products WHERE stage = '11' ORDER BY code;";
 		$result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
 		while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
 			$brews[] = array(
@@ -592,7 +592,7 @@
 				'code' => $row['code'],
 				'date' => substr($row['brew_date_start'], 0, 10),
 				'style' => $row['st_name'],
-				'og' => $row['og'],
+				'og' => $row['brew_fermenter_sg'],
 				'fg' => $row['fg'],
 				'batch_size' => $row['batch_size']
 			);
@@ -603,7 +603,7 @@
 	}
 
 	if (isset($_GET['select']) && ($_GET['select'] == "archdate")) {
-		$query = "SELECT record,name,code,brew_date_start,st_name,og,fg,batch_size FROM products WHERE stage = '11' ORDER BY brew_date_start;";
+		$query = "SELECT record,name,code,brew_date_start,st_name,brew_fermenter_sg,fg,batch_size FROM products WHERE stage = '11' ORDER BY brew_date_start;";
 		$result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
 		while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
 			$brews[] = array(
@@ -613,7 +613,7 @@
 				'year' => substr($row['brew_date_start'], 0, 4),
 				'date' => substr($row['brew_date_start'], 0, 10),
 				'style' => $row['st_name'],
-				'og' => $row['og'],
+				'og' => $row['brew_fermenter_sg'],
 				'fg' => $row['fg'],
 				'batch_size' => $row['batch_size']
 			);
--- a/www/js/global.js	Sun Dec 29 14:43:04 2019 +0100
+++ b/www/js/global.js	Fri Jan 03 15:21:22 2020 +0100
@@ -422,10 +422,12 @@
 Show1dec = { inputMode: 'simple', theme: theme, width: 90, height: 23, readOnly: true, decimalDigits: 1 },
 Show2dec = { inputMode: 'simple', theme: theme, width: 90, height: 23, readOnly: true, decimalDigits: 2 },
 Show3dec = { inputMode: 'simple', theme: theme, width: 90, height: 23, readOnly: true, decimalDigits: 3 },
+Show4dec = { inputMode: 'simple', theme: theme, width: 90, height: 23, readOnly: true, decimalDigits: 4 },
   SGopts = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.990, max: 1.199, decimalDigits: 3, spinButtons: true },
 Spin1dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true },
 Spin2dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true },
 Spin3dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 3, spinButtons: true },
+Spin4dec = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 4, spinButtons: true },
   SpinpH = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 1, spinButtons: true },
  Spin2pH = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1, max: 14, decimalDigits: 2, spinButtons: true },
   YeastT = { inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 45, decimalDigits: 1, spinButtons: true },
--- a/www/js/prod_edit.js	Sun Dec 29 14:43:04 2019 +0100
+++ b/www/js/prod_edit.js	Fri Jan 03 15:21:22 2020 +0100
@@ -1822,7 +1822,7 @@
 
    if ((dataRecord.brew_fermenter_volume * ogx + addedmass) > 0) {
     pt = 100 * sug / (dataRecord.brew_fermenter_volume * ogx + addedmass + topw);
-    dataRecord.brew_fermenter_sg = Round(plato_to_sg(pt), 4);
+    dataRecord.og = dataRecord.brew_fermenter_sg = Round(plato_to_sg(pt), 4);
     $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg);
     // color
     if (dataRecord.color_method == 4) {

mercurial