diff -r 01b393df529a -r e6e7ec9e33e0 www/js/prod_edit.js --- a/www/js/prod_edit.js Sat Apr 27 13:08:53 2019 +0200 +++ b/www/js/prod_edit.js Mon Apr 29 17:10:38 2019 +0200 @@ -1008,10 +1008,10 @@ } function setRangeIndicator(ion, rangeCode) { - if (rangeCode == "low") - $("#wr_"+ion).html(""+rangeCode + ""); - else if (rangeCode == "high") - $("#wr_"+ion).html(""+rangeCode+""); + if (rangeCode == "laag") + $("#wr_"+ion).html(""+rangeCode + ""); + else if (rangeCode == "hoog") + $("#wr_"+ion).html(""+rangeCode+""); else $("#wr_"+ion).html(""); } @@ -1485,15 +1485,37 @@ // 2:1 Sulfate to Chroride IPA's, Pale Ales. // 1:1 Sulfate to Chloride Balanced // 1:2 Sulfate to Chloride Malty + // Note, values below are the other way, cl to so4! + // So: 0.5 is IPA's, Pale Ales. + // 1 Balanced + // 2 Malty. $('#tgt_bu').val(Math.round(GetBUGU() * 100) / 100); - $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10); // Show real value too + // From brouwhulp. + if (GetBUGU() < 0.32) + $('#wr_bu').html("Zeer zoet"); + else if (GetBUGU() < 0.43) + $('#wr_bu').html("Zoet"); + else if (GetBUGU() < 0.52) + $('#wr_bu').html("Evenwichtig"); + else if (GetBUGU() < 0.63) + $('#wr_bu').html("Bitter"); + else + $('#wr_bu').html("Zeer bitter"); + $('#tgt_cl_so4').val(Math.round(GetOptClSO4ratio() * 10) / 10); if (sulfate > 0) RA = chloride / sulfate; else RA = 10; + $('#got_cl_so4').val(Math.round(RA * 10) / 10); var piCLSO4_low = 0.8 * GetOptClSO4ratio(); var piCLSO4_high = 1.2 * GetOptClSO4ratio(); - console.log("low: "+piCLSO4_low+" val: "+RA+" high: "+piCLSO4_high); + var Res = 'normaal'; + if (RA < piCLSO4_low) + Res = 'laag'; + else if (RA > piCLSO4_high) + Res = 'hoog'; + setRangeIndicator('cl_so4', Res); +// console.log("low: "+piCLSO4_low+" val: "+RA+" high: "+piCLSO4_high); $('#wb_calcium').val(Math.round(calcium * 10) / 10); $('#wb_magnesium').val(Math.round(magnesium * 10) / 10); @@ -1503,38 +1525,44 @@ $('#wb_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10); if (calcium < 40) { - setRangeIndicator("calcium", "low"); + setRangeIndicator("calcium", "laag"); } else if (calcium > 150) { - setRangeIndicator("calcium", "high"); + setRangeIndicator("calcium", "hoog"); } else { - setRangeIndicator("calcium", "normal"); + setRangeIndicator("calcium", "normaal"); } if (magnesium >= 0 && magnesium <= 30) { - setRangeIndicator("magnesium", "normal"); + setRangeIndicator("magnesium", "normaal"); } else { - setRangeIndicator("magnesium", "high"); + setRangeIndicator("magnesium", "hoog"); } if (sodium <= 150) { - setRangeIndicator("sodium", "normal"); - } else { - setRangeIndicator("sodium", "high"); - } - if (chloride <= 100) { - setRangeIndicator("chloride", "normal"); + setRangeIndicator("sodium", "normaal"); } else { - setRangeIndicator("chloride", "high"); + setRangeIndicator("sodium", "hoog"); } - if (sulfate <= 350) { - setRangeIndicator("sulfate", "normal"); + // Both chloride and sulfate should be above 50 according to + // John Palmer. So the Cl/SO4 ratio calculation will work. + if (chloride <= 50) { + setRangeIndicator("chloride", "laag"); + } else if (chloride <= 100) { + setRangeIndicator("chloride", "normaal"); } else { - setRangeIndicator("sulfate", "high"); + setRangeIndicator("chloride", "hoog"); + } + if (sulfate <= 50) { + setRangeIndicator("sulfate", "laag"); + } else if (sulfate <= 350) { + setRangeIndicator("sulfate", "normaal"); + } else { + setRangeIndicator("sulfate", "hoog"); } if (ph < 5.2) { - setRangeIndicator("ph", "low"); + setRangeIndicator("ph", "laag"); } else if (ph > 5.6) { - setRangeIndicator("ph", "high"); + setRangeIndicator("ph", "hoog"); } else { - setRangeIndicator("ph", "normal"); + setRangeIndicator("ph", "normaal"); } calcSparge(); } @@ -4936,6 +4964,7 @@ // Tab 8, Water $("#tgt_bu").jqxNumberInput( Show2wat ); $("#tgt_cl_so4").jqxNumberInput( Show1wat ); + $("#got_cl_so4").jqxNumberInput( Show1wat ); // Water source 1 $("#w1_name").jqxDropDownList({ @@ -5043,9 +5072,9 @@ $("#wb_sodium").jqxNumberInput( Show1wat ); $("#wb_total_alkalinity").jqxNumberInput( Show1wat ); - $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is lager dan 100.'}); + $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'}); $("#wb_chloride").jqxNumberInput( Show1wat ); - $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is lager dan 350.'}); + $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'}); $("#wb_sulfate").jqxNumberInput( Show1wat ); $("#wb_ph").jqxNumberInput( Show1wat );