diff -r f56c269dddfb -r 7f5455806f20 www/js/prod_edit.js
--- a/www/js/prod_edit.js Wed May 15 21:28:07 2019 +0200
+++ b/www/js/prod_edit.js Sun May 26 16:09:50 2019 +0200
@@ -754,6 +754,22 @@
function calcYeast() {
+ // Calculate needed cells.
+ var sg = dataRecord.brew_fermenter_sg;
+ if (sg <= 1.0001 && dataRecord.fg > 1.000)
+ sg = dataRecord.fg;
+ else if (sg <= 1.0001)
+ sg = dataRecord.est_og;
+ var plato = sg_to_plato(sg);
+
+ var volume = dataRecord.brew_fermenter_volume;
+ if (volume > 0) {
+ if (dataRecord.brew_fermenter_extrawater > 0)
+ volume += dataRecord.brew_fermenter_extrawater;
+ } else {
+ volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss;
+ }
+
// Also in calcFermentables()
$("#yeast_cells").val(initcells);
@@ -780,77 +796,90 @@
}
}
}
- var needed = getNeededYeastCells();
- console.log("calcYeast() pitchrate:"+pitchrate+" start:"+initcells+" needed:"+needed);
- calcSteps(dataRecord.starter_type, initcells, needed);
+ var needed = pitchrate * volume * plato;
+ console.log("calcYeast() pitchrate:"+pitchrate+" start:"+initcells+" needed:"+needed+" volume:"+volume);
$("#need_cells").val(needed);
-
- $("#r1_irate").html("");
- $("#r1_growf").html("");
- $("#r1_tcells").html("");
- if (parseFloat($("#prop1_volume").val()) > 0) {
- if ((parseFloat($("#prop1_irate").val()) < 25) || (parseFloat($("#prop1_irate").val()) > 100)) {
- $("#r1_irate").html("");
- } else {
- $("#r1_irate").html("");
- }
- if (parseFloat($("#prop1_growf").val()) < 1)
- $("#r1_growf").html("");
- if (($("#prop1_type").val() > 0) && (parseFloat($("#prop1_growf").val()) > 3))
- $("#r1_growf").html("");
- if (parseFloat($("#prop1_tcells").val()) > needed)
- $("#r1_tcells").html("");
- }
- $("#r2_irate").html("");
- $("#r2_growf").html("");
- $("#r2_tcells").html("");
- if (parseFloat($("#prop2_volume").val()) > 0) {
- if ((parseFloat($("#prop2_irate").val()) < 25) || (parseFloat($("#prop2_irate").val()) > 100)) {
- $("#r2_irate").html("");
- } else {
- $("#r2_irate").html("");
+ var use_cells = initcells;
+
+ if (dataRecord.starter_enable) {
+ calcSteps(dataRecord.starter_type, initcells, needed);
+
+ $("#r1_irate").html("");
+ $("#r1_growf").html("");
+ $("#r1_tcells").html("");
+ if (parseFloat($("#prop1_volume").val()) > 0) {
+ if ((parseFloat($("#prop1_irate").val()) < 25) || (parseFloat($("#prop1_irate").val()) > 100)) {
+ $("#r1_irate").html("");
+ } else {
+ $("#r1_irate").html("");
+ }
+ if (parseFloat($("#prop1_growf").val()) < 1)
+ $("#r1_growf").html("");
+ if (($("#prop1_type").val() > 0) && (parseFloat($("#prop1_growf").val()) > 3))
+ $("#r1_growf").html("");
+ if (parseFloat($("#prop1_tcells").val()) > needed) {
+ $("#r1_tcells").html("");
+ use_cells = parseFloat($("#prop1_tcells").val());
+ }
}
- if (parseFloat($("#prop2_growf").val()) < 1)
- $("#r2_growf").html("");
- if (($("#prop2_type").val() > 0) && (parseFloat($("#prop2_growf").val()) > 3))
- $("#r2_growf").html("");
- if (parseFloat($("#prop2_tcells").val()) > needed)
- $("#r2_tcells").html("");
- }
- $("#r3_irate").html("");
- $("#r3_growf").html("");
- $("#r3_tcells").html("");
- if (parseFloat($("#prop3_volume").val()) > 0) {
- if ((parseFloat($("#prop3_irate").val()) < 25) || (parseFloat($("#prop3_irate").val()) > 100)) {
- $("#r3_irate").html("");
- } else {
- $("#r3_irate").html("");
+ $("#r2_irate").html("");
+ $("#r2_growf").html("");
+ $("#r2_tcells").html("");
+ if (parseFloat($("#prop2_volume").val()) > 0) {
+ if ((parseFloat($("#prop2_irate").val()) < 25) || (parseFloat($("#prop2_irate").val()) > 100)) {
+ $("#r2_irate").html("");
+ } else {
+ $("#r2_irate").html("");
+ }
+ if (parseFloat($("#prop2_growf").val()) < 1)
+ $("#r2_growf").html("");
+ if (($("#prop2_type").val() > 0) && (parseFloat($("#prop2_growf").val()) > 3))
+ $("#r2_growf").html("");
+ if (parseFloat($("#prop2_tcells").val()) > needed) {
+ $("#r2_tcells").html("");
+ use_cells = parseFloat($("#prop2_tcells").val());
+ }
}
- if (parseFloat($("#prop3_growf").val()) < 1)
- $("#r3_growf").html("");
- if (($("#prop3_type").val() > 0) && (parseFloat($("#prop3_growf").val()) > 3))
- $("#r3_growf").html("");
- if (parseFloat($("#prop3_tcells").val()) > needed)
- $("#r3_tcells").html("");
+ $("#r3_irate").html("");
+ $("#r3_growf").html("");
+ $("#r3_tcells").html("");
+ if (parseFloat($("#prop3_volume").val()) > 0) {
+ if ((parseFloat($("#prop3_irate").val()) < 25) || (parseFloat($("#prop3_irate").val()) > 100)) {
+ $("#r3_irate").html("");
+ } else {
+ $("#r3_irate").html("");
+ }
+ if (parseFloat($("#prop3_growf").val()) < 1)
+ $("#r3_growf").html("");
+ if (($("#prop3_type").val() > 0) && (parseFloat($("#prop3_growf").val()) > 3))
+ $("#r3_growf").html("");
+ if (parseFloat($("#prop3_tcells").val()) > needed) {
+ $("#r3_tcells").html("");
+ use_cells = parseFloat($("#prop3_tcells").val());
+ }
+ }
+ $("#r4_irate").html("");
+ $("#r4_growf").html("");
+ $("#r4_tcells").html("");
+ if (parseFloat($("#prop4_volume").val()) > 0) {
+ if ((parseFloat($("#prop4_irate").val()) < 25) || (parseFloat($("#prop4_irate").val()) > 100)) {
+ $("#r4_irate").html("");
+ } else {
+ $("#r4_irate").html("");
+ }
+ if (parseFloat($("#prop4_growf").val()) < 1)
+ $("#r4_growf").html("");
+ if (($("#prop4_type").val() > 0) && (parseFloat($("#prop4_growf").val()) > 3))
+ $("#r4_growf").html("");
+ if (parseFloat($("#prop4_tcells").val()) > needed) {
+ $("#r4_tcells").html("");
+ use_cells = parseFloat($("#prop4_tcells").val());
+ }
+ } else {
+ $("#r4_irate").html("");
+ }
}
- $("#r4_irate").html("");
- $("#r4_growf").html("");
- $("#r4_tcells").html("");
- if (parseFloat($("#prop4_volume").val()) > 0) {
- if ((parseFloat($("#prop4_irate").val()) < 25) || (parseFloat($("#prop4_irate").val()) > 100)) {
- $("#r4_irate").html("");
- } else {
- $("#r4_irate").html("");
- }
- if (parseFloat($("#prop4_growf").val()) < 1)
- $("#r4_growf").html("");
- if (($("#prop4_type").val() > 0) && (parseFloat($("#prop4_growf").val()) > 3))
- $("#r4_growf").html("");
- if (parseFloat($("#prop4_tcells").val()) > needed)
- $("#r4_tcells").html("");
- } else {
- $("#r4_irate").html("");
- }
+ $("#plato_cells").val(parseFloat(use_cells / (volume * plato) ));
};
function adjustHops(factor) {
@@ -1928,6 +1957,10 @@
$("#sparge_source").jqxDropDownList({ disabled: true });
$("#sparge_acid_type").jqxDropDownList({ disabled: true });
$("#sparge_acid_perc").jqxNumberInput({ spinButtons: false, readOnly: true, width: false });
+ $("#starter_enable").jqxCheckBox({ disabled: true });
+ $("#starter_type").jqxDropDownList({ disabled: true });
+ $("#starter_try").jqxButton({ disabled: true });
+ $("#starter_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
}
if (dataRecord.stage > 3) { // Primary fermentation done
$("#brew_date_start").jqxDateTimeInput({ disabled: true });
@@ -2037,6 +2070,7 @@
$("#starter_enable").on('unchecked', function (event) {
dataRecord.starter_enable = 0;
showStarter();
+ calcYeast();
});
$("#starter_try").click(function () {
$("#prop1_volume").val(0);
@@ -4782,7 +4816,7 @@
$("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
$("#yeast_cells").jqxNumberInput( Show1dec );
$("#need_cells").jqxNumberInput( Show1dec );
- $("#plato_cells").jqxNumberInput( Show1dec );
+ $("#plato_cells").jqxNumberInput( Show2dec );
$("#popupYeast").jqxWindow({
width: 800,
height: 300,