# HG changeset patch # User Michiel Broek # Date 1575292828 -3600 # Node ID 7c4f34b7e16f3abb2a554f55b8194f68be6830a0 # Parent c62ff53cfc3d481aa6e3f1f55b8a80cbddd5bb8c A bit of code optimization in calcWater() diff -r c62ff53cfc3d -r 7c4f34b7e16f www/js/prod_edit.js --- a/www/js/prod_edit.js Mon Dec 02 13:24:34 2019 +0100 +++ b/www/js/prod_edit.js Mon Dec 02 14:20:28 2019 +0100 @@ -2803,7 +2803,7 @@ AT, BT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, r1d, r2d, f1d, f2d, f3d, deltapH, deltapd, pd, n, - piCLSO4_low, piCLSO4_high, Res, + Res, wg_calcium, wg_sodium, wg_total_alkalinity, wg_chloride, wg_sulfate, wg_bicarbonate; if (dataRecord.w1_name == '') { @@ -3117,34 +3117,36 @@ chloride = wg_chloride + RA; } - $('#tgt_bu').val(Round(GetBUGU(), 2)); + var BUGU = GetBUGU(); + $('#tgt_bu').val(Round(BUGU, 2)); // From brouwhulp. - if (GetBUGU() < 0.32) + if (BUGU < 0.32) $('#wr_bu').html("Zeer moutig en zoet"); - else if (GetBUGU() < 0.43) + else if (BUGU < 0.43) $('#wr_bu').html("Moutig, zoet"); - else if (GetBUGU() < 0.52) + else if (BUGU < 0.52) $('#wr_bu').html("Evenwichtig"); - else if (GetBUGU() < 0.63) + else if (BUGU < 0.63) $('#wr_bu').html("Licht hoppig, bitter"); else $('#wr_bu').html("Extra hoppig, zeer bitter"); // Sulfate to Chloride ratio (Palmer). - $('#tgt_so4_cl').val(Round(GetOptSO4Clratio(), 1)); - if (GetOptSO4Clratio() < 0.4) + var OptSO4Clratio = GetOptSO4Clratio(); + $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1)); + if (OptSO4Clratio < 0.4) $('#wrt_so4_cl').html("Te moutig"); - else if (GetOptSO4Clratio() < 0.6) + else if (OptSO4Clratio < 0.6) $('#wrt_so4_cl').html("Zeer moutig"); - else if (GetOptSO4Clratio() < 0.8) + else if (OptSO4Clratio < 0.8) $('#wrt_so4_cl').html("Moutig"); - else if (GetOptSO4Clratio() < 1.5) + else if (OptSO4Clratio < 1.5) $('#wrt_so4_cl').html("Gebalanceerd"); - else if (GetOptSO4Clratio() < 2.0) + else if (OptSO4Clratio < 2.0) $('#wrt_so4_cl').html("Licht bitter"); - else if (GetOptSO4Clratio() < 4.0) + else if (OptSO4Clratio < 4.0) $('#wrt_so4_cl').html("Bitter"); - else if (GetOptSO4Clratio() < 9.0) + else if (OptSO4Clratio < 9.0) $('#wrt_so4_cl').html("Zeer bitter"); else $('#wrt_so4_cl').html("Te bitter"); @@ -3153,12 +3155,10 @@ else RA = 10; $('#got_so4_cl').val(Round(RA, 1)); - piCLSO4_low = 0.8 * GetOptSO4Clratio(); - piCLSO4_high = 1.2 * GetOptSO4Clratio(); Res = 'normaal'; - if (RA < piCLSO4_low) + if (RA < (0.8 * OptSO4Clratio)) Res = 'laag'; - else if (RA > piCLSO4_high) + else if (RA > (1.2 * OptSO4Clratio)) Res = 'hoog'; setRangeIndicator('so4_cl', Res);