Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.

Wed, 18 Mar 2020 19:46:15 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 18 Mar 2020 19:46:15 +0100
changeset 642
9d1af81b20ef
parent 641
ab6423be2a1e
child 643
9ac2fb6b1311

Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.

www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/js/rec_edit.js file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Wed Mar 18 14:36:11 2020 +0100
+++ b/www/js/prod_edit.js	Wed Mar 18 19:46:15 2020 +0100
@@ -64,6 +64,8 @@
  ok_yeasts = 1,       // Yeasts are in stock
  ok_waters = 1,       // Waters are in stock
 
+ error_count = 0;
+
  hop_flavour = 0,
  hop_aroma = 0,
  mash_infuse = 0,
@@ -2403,6 +2405,7 @@
 
   if (maybe_starter != dataRecord.starter_enable) {
    dataRecord.starter_enable = maybe_starter;
+   showStarter();
   }
 
   if (dataRecord.starter_enable) {
@@ -2770,12 +2773,15 @@
     }
    }
   } else {
-   console.log('ProtonDeficit(' + pHZ + ') invalid grist, return ' + Result);
+   error_count++;
+   if (error_count < 5)
+    console.log('ProtonDeficit(' + pHZ + ') invalid grist, return ' + Result);
   }
   return Result;
  }
 
  function MashpH() {
+  console.log('MashpH()');
   var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH);
   while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
    n++;
@@ -3103,6 +3109,7 @@
 
     deltapH = 0.001;
     deltapd = 0.1;
+    console.log('in calcWater() manual');
     pd = ProtonDeficit(pHa);
     n = 0;
     while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 2000)) {
@@ -3689,10 +3696,14 @@
   calcEfficiencyAfterBoil();
 
   $('#starter_try').click(function() {
-   $('#prop1_volume,#prop2_volume,#prop3_volume,#prop4_volume').val(0);
+   $('#prop1_volume').val(0);
+   $('#prop2_volume').val(0);
+   $('#prop3_volume').val(0);
+   $('#prop4_volume').val(0);
+   dataRecord.prop1_volume = dataRecord.prop2_volume = dataRecord.prop3_volume = dataRecord.prop4_volume = 0;
    calcYeast();
   });
-  $('#starter_type').on('change', function(event) {
+  $('#starter_type').on('select', function(event) {
    if (event.args) {
     dataRecord.starter_type = event.args.index;
     calcYeast();
@@ -3704,7 +3715,7 @@
     calcYeast();
    }
   });
-  $('#prop1_type').on('change', function(event) {
+  $('#prop1_type').on('select', function(event) {
    if (event.args) {
     dataRecord.prop1_type = event.args.index;
     calcYeast();
@@ -3716,7 +3727,7 @@
     calcYeast();
    }
   });
-  $('#prop2_type').on('change', function(event) {
+  $('#prop2_type').on('select', function(event) {
    if (event.args) {
     dataRecord.prop2_type = event.args.index;
     calcYeast();
@@ -3728,7 +3739,7 @@
     calcYeast();
    }
   });
-  $('#prop3_type').on('change', function(event) {
+  $('#prop3_type').on('select', function(event) {
    if (event.args) {
     dataRecord.prop3_type = event.args.index;
     calcYeast();
@@ -3740,7 +3751,7 @@
     calcYeast();
    }
   });
-  $('#prop4_type').on('change', function(event) {
+  $('#prop4_type').on('select', function(event) {
    if (event.args) {
     dataRecord.prop4_type = event.args.index;
     calcYeast();
@@ -3813,7 +3824,7 @@
     calcWater();
    }
   });
-  $('#wa_base_name').on('change', function(event) {
+  $('#wa_base_name').on('select', function(event) {
    if (event.args) {
     var index = event.args.index;
     console.log('wa_base_name ' + index);
@@ -3829,7 +3840,7 @@
    setWaterAgent(name, parseFloat(event.args.value));
    calcWater();
   });
-  $('#wa_acid_name').on('change', function(event) {
+  $('#wa_acid_name').on('select', function(event) {
    if (event.args) {
     var index = event.args.index;
     console.log('wa_acid_name ' + index);
@@ -3847,11 +3858,11 @@
   });
   $('#wa_acid_perc').on('change', function(event) { calcWater(); });
 
-  $('#color_method').on('change', function(event) {
+  $('#color_method').on('select', function(event) {
    dataRecord.color_method = event.args.index;
    calcFermentables();
   });
-  $('#ibu_method').on('change', function(event) {
+  $('#ibu_method').on('select', function(event) {
    dataRecord.ibu_method = event.args.index;
    calcFermentables();
    calcIBUs();
@@ -3930,13 +3941,13 @@
    dataRecord.sparge_temp = parseFloat(event.args.value);
    $('#brew_sparge_temperature').val(dataRecord.sparge_temp);
   });
-  $('#sparge_source').on('change', function(event) {
+  $('#sparge_source').on('select', function(event) {
    if (event.args) {
     dataRecord.sparge_source = event.args.index;
     calcSparge();
    }
   });
-  $('#sparge_acid_type').on('change', function(event) {
+  $('#sparge_acid_type').on('select', function(event) {
    if (event.args) {
     dataRecord.sparge_acid_type = event.args.index;
     console.log('new sparge_acid_type: ' + dataRecord.sparge_acid_type);
--- a/www/js/rec_edit.js	Wed Mar 18 14:36:11 2020 +0100
+++ b/www/js/rec_edit.js	Wed Mar 18 19:46:15 2020 +0100
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2018-2019
+ * Copyright (C) 2018-2020
  *
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -2527,7 +2527,7 @@
     calcWater();
    }
   });
-  $('#wa_base_name').on('change', function(event) {
+  $('#wa_base_name').on('select', function(event) {
    if (event.args) {
     var index = event.args.index;
     setWaterAgent(last_base, 0);
@@ -2542,7 +2542,7 @@
    setWaterAgent(name, parseFloat(event.args.value));
    calcWater();
   });
-  $('#wa_acid_name').on('change', function(event) {
+  $('#wa_acid_name').on('select', function(event) {
    if (event.args) {
     var index = event.args.index;
     setWaterAgent(last_acid, 0);
@@ -2559,11 +2559,11 @@
   });
   $('#wa_acid_perc').on('change', function(event) { calcWater(); });
 
-  $('#color_method').on('change', function(event) {
+  $('#color_method').on('select', function(event) {
    dataRecord.color_method = event.args.index;
    calcFermentables();
   });
-  $('#ibu_method').on('change', function(event) {
+  $('#ibu_method').on('select', function(event) {
    dataRecord.ibu_method = event.args.index;
    calcFermentables();
    calcIBUs();
@@ -2629,14 +2629,14 @@
    dataRecord.sparge_volume = parseFloat(event.args.value);
    calcSparge();
   });
-  $('#sparge_source').on('change', function(event) {
+  $('#sparge_source').on('select', function(event) {
    if (event.args) {
     var index = event.args.index;
     dataRecord.sparge_source = index;
     calcSparge();
    }
   });
-  $('#sparge_acid_type').on('change', function(event) {
+  $('#sparge_acid_type').on('select', function(event) {
    if (event.args) {
     var index = event.args.index;
     dataRecord.sparge_acid_type = index;

mercurial