# HG changeset patch # User Michiel Broek # Date 1559303072 -7200 # Node ID eb8ce63eb489d211a42b9730e790291d0fff860b # Parent 031842114e9d7d6f69522145c86a4e7c636dc2a9 Use extra decimal in yeast starter calculation. Show correct Cellen/ml °P even when the starter does not provide enough cells. Starter display results are written in a for loop. diff -r 031842114e9d -r eb8ce63eb489 README.design --- a/README.design Thu May 30 23:15:13 2019 +0200 +++ b/README.design Fri May 31 13:44:32 2019 +0200 @@ -16,7 +16,7 @@ Gisten diastaticus bit toevoegen. Gist typen: kveik en brett? Apart of niet. -Popups is de editors met rekenhulpjes. +Popups in de editors met rekenhulpjes. Beerxml cool tot temp toevoegen. diff -r 031842114e9d -r eb8ce63eb489 www/js/prod_edit.js --- a/www/js/prod_edit.js Thu May 30 23:15:13 2019 +0200 +++ b/www/js/prod_edit.js Fri May 31 13:44:32 2019 +0200 @@ -536,7 +536,7 @@ var irate = Math.round(prate * 10) / 10; var egrams = (dataRecord.starter_sg - 1) * svol * gperpoint; var grate = getGrowthRate(stype, start, egrams); - var ncells = Math.round(egrams * grate); + var ncells = Math.round(egrams * grate * 10) / 10; var totcells = parseFloat(ncells) + start; console.log("svol:"+svol+" start:"+start+" irate:"+irate+" egrams:"+egrams+" grate:"+grate+" ncells:"+ncells); return { @@ -813,80 +813,27 @@ 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(""); + for (var i = 1; i < 5; i++) { + $("#r"+i+"_irate").html(""); + $("#r"+i+"_growf").html(""); + $("#r"+i+"_tcells").html(""); + if (parseFloat($("#prop"+i+"_volume").val()) > 0) { + if ((parseFloat($("#prop"+i+"_irate").val()) < 25) || (parseFloat($("#prop"+i+"_irate").val()) > 100)) { + $("#r"+i+"_irate").html(""); + } else { + $("#r"+i+"_irate").html(""); + } + if (parseFloat($("#prop"+i+"_growf").val()) < 1) + $("#r"+i+"_growf").html(""); + if (($("#prop"+i+"_type").val() > 0) && (parseFloat($("#prop"+i+"_growf").val()) > 3)) + $("#r"+i+"_growf").html(""); + if (parseFloat($("#prop"+i+"_tcells").val()) > needed) + $("#r"+i+"_tcells").html(""); + use_cells = parseFloat($("#prop"+i+"_tcells").val()); } 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()); - } - } - $("#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()); + $("#r"+i+"_irate").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(""); - } } $("#plato_cells").val(parseFloat(use_cells / (volume * plato) )); };