Yeast starter now automatic adds or removes step lines as they are needed.

Sun, 05 Apr 2020 12:51:10 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 05 Apr 2020 12:51:10 +0200
changeset 649
52053730f6e1
parent 648
ee69b01fcb0e
child 650
fd7da9570810

Yeast starter now automatic adds or removes step lines as they are needed.

README.design file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/README.design	Sun Mar 29 17:05:52 2020 +0200
+++ b/README.design	Sun Apr 05 12:51:10 2020 +0200
@@ -12,9 +12,6 @@
   van de vergisting. Gaat vooral fout met de Saison.
   NOOT: experimentele wijziging is toegevoegd op 5-dec-2019. New Cubic van seanterrill.
 
-Wish:
-  Giststarter automatisch aantal regels aanpassen bij wijzigen van de hoeveelheden.
-
 Extra:
 
 Gisten: = Cultures?
--- a/www/js/prod_edit.js	Sun Mar 29 17:05:52 2020 +0200
+++ b/www/js/prod_edit.js	Sun Apr 05 12:51:10 2020 +0200
@@ -2171,6 +2171,33 @@
   };
  }
 
+ function killstep2() {
+
+  dataRecord.prop2_volume = 0;
+  $('#prop2_volume').val(0);
+  $('#prop2_tcells').val(0);
+  $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').hide();
+  $('#r2_pmpt').show();
+ }
+
+ function killstep3() {
+
+  dataRecord.prop3_volume = 0;
+  $('#prop3_volume').val(0);
+  $('#prop3_tcells').val(0);
+  $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').hide();
+  $('#r3_pmpt').show();
+ }
+
+ function killstep4() {
+
+  dataRecord.prop4_volume = 0;
+  $('#prop4_volume').val(0);
+  $('#prop4_tcells').val(0);
+  $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').hide();
+  $('#r4_pmpt').show();
+ }
+
  /*
   * Calculate all starter steps.
   * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple.
@@ -2303,6 +2330,16 @@
     $('#prop1_ncells').val(result.ncells);
     $('#prop1_tcells').val(result.totcells);
     $('#prop1_growf').val(result.growf);
+    if (result.totcells > needed) {
+     killstep2();
+     killstep3();
+     killstep4();
+    } else if (dataRecord.prop2_volume == 0) {
+     dataRecord.prop2_volume = dataRecord.prop1_volume; /* Extra step needed, start with the same size */
+     dataRecord.prop2_type = dataRecord.prop1_type;
+     $('#prop2_volume').val(dataRecord.prop2_volume);
+     $('#prop2_type').val(dataRecord.prop2_type);
+    }
    }
    if (dataRecord.prop2_volume > 0) {
     $('#r2_pmpt').hide();
@@ -2312,6 +2349,15 @@
     $('#prop2_ncells').val(result.ncells);
     $('#prop2_tcells').val(result.totcells);
     $('#prop2_growf').val(result.growf);
+    if (result.totcells > needed) {
+     killstep3();
+     killstep4();
+    } else if (dataRecord.prop3_volume == 0) {
+     dataRecord.prop3_volume = dataRecord.prop2_volume; /* Extra step needed, start with the same size */
+     dataRecord.prop3_type = dataRecord.prop2_type;
+     $('#prop3_volume').val(dataRecord.prop3_volume);
+     $('#prop3_type').val(dataRecord.prop3_type);
+    }
    }
    if (dataRecord.prop3_volume > 0) {
     $('#r3_pmpt').hide();
@@ -2321,6 +2367,14 @@
     $('#prop3_ncells').val(result.ncells);
     $('#prop3_tcells').val(result.totcells);
     $('#prop3_growf').val(result.growf);
+    if (result.totcells > needed) {
+     killstep4();
+    } else if (dataRecord.prop4_volume == 0) {
+     dataRecord.prop4_volume = dataRecord.prop3_volume; /* Extra step needed, start with the same size */
+     dataRecord.prop4_type = dataRecord.prop3_type;
+     $('#prop4_volume').val(dataRecord.prop4_volume);
+     $('#prop4_type').val(dataRecord.prop4_type);
+    }
    }
    if (dataRecord.prop4_volume > 0) {
     $('#r4_pmpt').hide();
@@ -3699,7 +3753,7 @@
    dataRecord.prop1_volume = dataRecord.prop2_volume = dataRecord.prop3_volume = dataRecord.prop4_volume = 0;
    calcYeast();
   });
-  $('#starter_type').on('select', function(event) {
+  $('#starter_type').on('change', function(event) {
    if (event.args) {
     dataRecord.starter_type = event.args.index;
     calcYeast();
@@ -3711,7 +3765,7 @@
     calcYeast();
    }
   });
-  $('#prop1_type').on('select', function(event) {
+  $('#prop1_type').on('change', function(event) {
    if (event.args) {
     dataRecord.prop1_type = event.args.index;
     calcYeast();
@@ -3723,7 +3777,7 @@
     calcYeast();
    }
   });
-  $('#prop2_type').on('select', function(event) {
+  $('#prop2_type').on('change', function(event) {
    if (event.args) {
     dataRecord.prop2_type = event.args.index;
     calcYeast();
@@ -3735,7 +3789,7 @@
     calcYeast();
    }
   });
-  $('#prop3_type').on('select', function(event) {
+  $('#prop3_type').on('change', function(event) {
    if (event.args) {
     dataRecord.prop3_type = event.args.index;
     calcYeast();
@@ -3747,7 +3801,7 @@
     calcYeast();
    }
   });
-  $('#prop4_type').on('select', function(event) {
+  $('#prop4_type').on('change', function(event) {
    if (event.args) {
     dataRecord.prop4_type = event.args.index;
     calcYeast();

mercurial