Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.

Wed, 04 Mar 2020 10:48:21 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 04 Mar 2020 10:48:21 +0100
changeset 622
39902353b159
parent 621
06322bcfecdf
child 623
4aee10bcb94e

Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.

www/js/global.js file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/prod_checklist.php file | annotate | diff | comparison | revisions
www/prod_edit.php file | annotate | diff | comparison | revisions
www/prod_print.php file | annotate | diff | comparison | revisions
--- a/www/js/global.js	Tue Mar 03 20:38:37 2020 +0100
+++ b/www/js/global.js	Wed Mar 04 10:48:21 2020 +0100
@@ -418,6 +418,7 @@
 Show3wat = { inputMode: 'simple', theme: theme, width: 74, height: 23, decimalDigits: 3, readOnly: true },
 Smal0dec = { inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true },
 Smal1dec = { inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true },
+Smal2dec = { inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 2, readOnly: true },
 Show0dec = { inputMode: 'simple', theme: theme, width: 90, height: 23, readOnly: true, decimalDigits: 0 },
 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 },
--- a/www/js/prod_edit.js	Tue Mar 03 20:38:37 2020 +0100
+++ b/www/js/prod_edit.js	Wed Mar 04 10:48:21 2020 +0100
@@ -2795,33 +2795,36 @@
 
   var rows, i, C1, ebc, x, Result = ZRA(pHZ) * parseFloat($('#wg_amount').jqxNumberInput('decimal'));
   // proton deficit for the grist
-  rows = $('#fermentableGrid').jqxGrid('getrows');
-  for (i = 0; i < rows.length; i++) {
-   row = rows[i];
-   if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt
-    // Check if acid is required
-    C1 = 0;
-    if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) {
-     C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7);
-    } else {
-     // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
-     ebc = row.f_color;
-     switch (row.f_graintype) {
-      case 0:                                 // Base, Special, Kilned
-      case 3:
-      case 5: C1 = 0.014 * ebc - 34.192;
-              break;
-      case 2: C1 = -0.0597 * ebc - 32.457;    // Crystal
-              break;
-      case 1: C1 = 0.0107 * ebc - 54.768;     // Roast
-              break;
-      case 4: C1 = -149;                      // Sour malt
-              break;
+  if ((rows = $('#fermentableGrid').jqxGrid('getrows'))) {
+   for (i = 0; i < rows.length; i++) {
+    row = rows[i];
+    if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt
+     // Check if acid is required
+     C1 = 0;
+     if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) {
+      C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7);
+     } else {
+      // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
+      ebc = row.f_color;
+      switch (row.f_graintype) {
+       case 0:                                 // Base, Special, Kilned
+       case 3:
+       case 5: C1 = 0.014 * ebc - 34.192;
+               break;
+       case 2: C1 = -0.0597 * ebc - 32.457;    // Crystal
+               break;
+       case 1: C1 = 0.0107 * ebc - 54.768;     // Roast
+               break;
+       case 4: C1 = -149;                      // Sour malt
+               break;
+      }
      }
+     x = C1 * (pHZ - row.f_di_ph);   // AcidRequired(ZpH)
+     Result += x * row.f_amount;
     }
-    x = C1 * (pHZ - row.f_di_ph);   // AcidRequired(ZpH)
-    Result += x * row.f_amount;
    }
+  } else {
+   console.log('ProtonDeficit(' + pHZ + ') invalid grist');
   }
   return Result;
  }
@@ -5268,13 +5271,13 @@
  // Tab 6, Yeasts
  $('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
  $('#est_fg2').jqxNumberInput(Show3dec);
- $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
- $('#est_abv2').jqxNumberInput(Smal1dec);
- $('#yeast_cells').jqxTooltip({ content: 'Het aantal beschikbare gistcellen zonder eventuele starter.' });
+ $('#est_abv2').jqxTooltip({ content: 'Verwacht alcohol volume %. Dit wordt automatisch berekend.' });
+ $('#est_abv2').jqxNumberInput(Show2dec);
+ $('#yeast_cells').jqxTooltip({ content: 'Het aantal miljard beschikbare gistcellen zonder eventuele starter.' });
  $('#yeast_cells').jqxNumberInput(Show1dec);
- $('#need_cells').jqxTooltip({ content: 'Het aantal nodige cellen is afhankelijk van het biertype.' });
+ $('#need_cells').jqxTooltip({ content: 'Het aantal miljard nodige cellen is afhankelijk van het begin SG, biertype en volume.' });
  $('#need_cells').jqxNumberInput(Show1dec);
- $('#plato_cells').jqxTooltip({ content: 'De berekende hoeveelheid gistcellen in miljard per ml per graad Plato. Dit is de zogenaamde pitchrate.' });
+ $('#plato_cells').jqxTooltip({ content: 'De berekende pitchrate in miljard cellen per ml per graad Plato.' });
  $('#plato_cells').jqxNumberInput(Show2dec);
  $('#yeast_prod_date').jqxTooltip({ content: 'Bij korrelgisten is meestal "best voor" datum op het zakje gedrukt.<br>Gebruik die datum maar dan twee jaar eerder als productie datum.<br>Bij White Labs is de productie datum vier maanden voor de "Best by" datum die geprint op het buisje.<br>Bij Wyeast is dit de "manufacture date" die op het pak geprint is.<br>Voor schuine buis, slurry, opkweek en gedroogd is dit de datum dat je de gist geoogst hebt.' });
  $('#yeast_prod_date').jqxDateTimeInput(Dateopts);
@@ -5453,7 +5456,7 @@
  $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' });
  $('#starter_sg').jqxNumberInput(SGopts);
  $('#starter_viability').jqxTooltip({ content: 'De gist conditie.' });
- $('#starter_viability').jqxNumberInput(Smal0dec);
+ $('#starter_viability').jqxNumberInput(Show0dec);
  $('#starter_try').jqxButton({ template: 'primary', width: '100px', height: 23, theme: theme });
 
 
--- a/www/prod_checklist.php	Tue Mar 03 20:38:37 2020 +0100
+++ b/www/prod_checklist.php	Wed Mar 04 10:48:21 2020 +0100
@@ -261,7 +261,7 @@
 			}
 			foreach($hops as $item2) {
 				if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
-					$s = sprintf("%.1f",$item2['h_amount']*1000*$factor).' gr `';
+					$s = sprintf("%.2f",$item2['h_amount']*1000*$factor).' gr `';
 					$s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` bij ';
 					if ($i > 0)
 						$s .= $i.' minuten voor einde koken';
@@ -273,7 +273,7 @@
 			foreach($miscs as $item3) {
 				if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
 					$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
-					$s = sprintf("%.1f",$item3['m_amount']*1000*$factor).$unit.'`';
+					$s = sprintf("%.2f",$item3['m_amount']*1000*$factor).$unit.'`';
 					$s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij ';
 					if ($i > 0)
 						$s .= $i.' minuten voor einde koken';
--- a/www/prod_edit.php	Tue Mar 03 20:38:37 2020 +0100
+++ b/www/prod_edit.php	Wed Mar 04 10:48:21 2020 +0100
@@ -260,12 +260,12 @@
       <table style="width: 100%;">
        <tr>
         <td style="vertical-align: top; float: right; padding: 3px;">Verwacht eind SG:</td>
-	<td style="padding: 3px;"><div id="est_fg2"></div></td>
-	<td align="center" colspan="5" rowspan="5">
+        <td style="padding: 3px;"><div id="est_fg2"></div></td>
+        <td align="center" colspan="5" rowspan="5">
          <div id="propagator">
           <table style="width: 100%;">
-	   <caption>Giststarter stappen</caption>
-	   <tr>
+           <caption>Giststarter stappen</caption>
+           <tr>
             <td style="width: 40px; padding: 3px;">Stap</td>
             <td align="left" style="vertical-align: top; padding: 3px;">Methode</td>
             <td style="width: 120px; padding: 3px;">Volume</td>
@@ -273,7 +273,7 @@
             <td style="width: 120px; padding: 3px;">Nieuwe cellen</td>
             <td style="width: 120px; padding: 3px;">Totaal cellen</td>
             <td style="width: 120px; padding: 3px;">Groei factor</td>
-	   </tr>
+           </tr>
            <tr>
             <td align="center">1</td>
             <td><div id="prop1_type"></div><div id="r1_pmpt">Niet nodig</div></td>
@@ -282,7 +282,7 @@
             <td><div id="prop1_ncells"></div></td>
             <td><div style="float: left;" id="prop1_tcells"></div><div style="float: left;" id="r1_tcells"></div></td>
             <td><div style="float: left;" id="prop1_growf"></div><div style="float: left;" id="r1_growf"></div></td>
-	   </tr>
+           </tr>
            <tr>
             <td align="center">2</td>
             <td><div id="prop2_type"></div><div id="r2_pmpt">Niet nodig</div></td>
@@ -302,48 +302,48 @@
             <td><div style="float: left;" id="prop3_growf"></div><div style="float: left;" id="r3_growf"></div></td>
            </tr>
            <tr>
-	    <td align="center">4</td>
+            <td align="center">4</td>
             <div id="prop4_row">
             <td><div id="prop4_type"></div><div id="r4_pmpt">Niet nodig</div></td>
             <td><div id="prop4_volume"></div></td>
             <td><div style="float: left;" id="prop4_irate"></div><div style="float: left;" id="r4_irate"></div></td>
             <td><div id="prop4_ncells"></div></td>
             <td><div style="float: left;" id="prop4_tcells"></div><div style="float: left;" id="r4_tcells"></div></td>
-	    <td><div style="float: left;" id="prop4_growf"></div><div style="float: left;" id="r4_growf"></div></td>
+            <td><div style="float: left;" id="prop4_growf"></div><div style="float: left;" id="r4_growf"></div></td>
             </div>
            </tr>
- 	  </table>
+          </table>
          </div>
         </td>
        </tr>
        <tr>
         <td style="vertical-align: top; float: right; padding: 3px;">Verwacht ABV %:</td>
-	<td style="padding: 3px;"><div id="est_abv2"></div></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Aantal cellen miljard:</td>
-        <td style="padding: 3px;"><div id="yeast_cells"></div></td>
+        <td style="padding: 3px;"><div id="est_abv2"></div></td>
        </tr>
        <tr>
         <td style="vertical-align: top; float: right; padding: 3px;">Gist productie datum:</td>
         <td style="padding: 3px;"><div id="yeast_prod_date"></div></td>
        </tr>
        <tr>
+        <td style="vertical-align: top; float: right; padding: 3px;">Gist conditie %:</td>
+        <td style="padding: 3px;"><div id="starter_viability"></div></td>
+       </tr>
+       <tr>
+        <td style="vertical-align: top; float: right; padding: 3px;">Gistcellen miljard:</td>
+        <td style="padding: 3px;"><div id="yeast_cells"></div></td>
+       </tr>
+       <tr>
         <td style="vertical-align: top; float: right; padding: 3px;">Cellen nodig miljard:</td>
         <td style="padding: 3px;"><div id="need_cells"></div></td>
        </tr>
        <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Cellen/ml &deg;P:</td>
+        <td style="vertical-align: top; float: right; padding: 3px;">Pitch cellen/ml &deg;P:</td>
         <td style="padding: 3px;"><div id="plato_cells"></div></td>
-       </tr>
-       <tr>
-        <td style="vertical-align: top; float: right; padding: 3px;">Gist conditie %:</td>
-        <td style="padding: 3px;"><div id="starter_viability"></div></td>
         <td style="vertical-align: top; float: right; padding: 3px;">Starter type:</td>
 	<td style="padding: 3px;"><div id="starter_type"></div></td>
 	<td style="vertical-align: top; float: right; padding: 3px;">Starter SG:</td>
         <td style="padding: 3px;"><div id="starter_sg"></div></td>
-        <td style="vertical-align: top; padding: 3px;"><input type="button" id="starter_try"  value="Probeer" /></td>
+        <td style="vertical-align: top; padding: 3px;"><input type="button" id="starter_try" value="Probeer" /></td>
        </tr>
        <tr><td colspan="7">&nbsp;</td></tr>
        <tr><td align="center" colspan="7"><div id="yeastGrid"></div></td></tr>
--- a/www/prod_print.php	Tue Mar 03 20:38:37 2020 +0100
+++ b/www/prod_print.php	Wed Mar 04 10:48:21 2020 +0100
@@ -369,7 +369,7 @@
 			$this->Cell($vul,5,$st." staps giststarter",0,0,'L',true);
 			$this->Cell(40,5,'',0,0,'R',true);
 			$this->Cell(30,5,"Vooraf",0,0,'L',true);
-			$this->Cell(20,5,sprintf("%.2f",$sv)." L",0,0,'R',true);
+			$this->Cell(20,5,sprintf("%.3f",$sv)." L",0,0,'R',true);
 			$this->Cell(20,5,'',0,0,'R',true);
 			$this->Ln();
 		}

mercurial