www/js/prod_edit.js

changeset 622
39902353b159
parent 621
06322bcfecdf
child 623
4aee10bcb94e
--- 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 });
 
 

mercurial