# HG changeset patch # User Michiel Broek # Date 1648133196 -3600 # Node ID e6e696add0b33f177cdf557a377b8075f6706dd2 # Parent 812ce4c5da2a85f42e24c466f07543c123d83930 Fixed some mess in water calculations. diff -r 812ce4c5da2a -r e6e696add0b3 www/export_equipments.php --- a/www/export_equipments.php Sat Mar 05 22:32:48 2022 +0100 +++ b/www/export_equipments.php Thu Mar 24 15:46:36 2022 +0100 @@ -79,7 +79,7 @@ xmlwriter_end_element($xw); xmlwriter_start_element($xw, 'CALC_BOIL_VOLUME'); - ($row['calc_boil_volume'] > 1) ? xmlwriter_text($xw, 'TRUE') : xmlwriter_text($xw, 'FALSE'); + ($row['calc_boil_volume'] > 0) ? xmlwriter_text($xw, 'TRUE') : xmlwriter_text($xw, 'FALSE'); xmlwriter_end_element($xw); xmlwriter_start_element($xw, 'TOP_UP_KETTLE'); diff -r 812ce4c5da2a -r e6e696add0b3 www/js/prod_edit.js --- a/www/js/prod_edit.js Sat Mar 05 22:32:48 2022 +0100 +++ b/www/js/prod_edit.js Thu Mar 24 15:46:36 2022 +0100 @@ -1728,6 +1728,7 @@ calcYeast(); calcInit(); calcMash(); + calcWater(); kookTijd(); console.log('calculations ready'); $('#jqxLoader').jqxLoader('close'); @@ -2306,6 +2307,11 @@ $('#mashGrid').jqxGrid('updaterow', i, row); } } + if ((dataRecord.w1_amount + dataRecord.w2_amount) == 0) { + dataRecord.w1_amount = infused; + $('#w1_amount').val(infused); + console.log("calcMash() fixed water 1 to " + infused); + } mashvol = Round(mashkg * MaltVolume + infused, 6); $('#est_mashvol').val(mashvol); h = Math.floor(mashtime / 60); @@ -2942,7 +2948,7 @@ function adjustWaters(factor) { - //console.log('adjustWaters(' + factor + ')'); + console.log('adjustWaters(' + factor + ')'); var amount, row, i, rowscount = dataRecord.mashs.length; if (rowscount == 0) return; @@ -3227,7 +3233,8 @@ } // If there is a dillute water source, mix the waters. - if (dataRecord.w2_name != '') { + if ((dataRecord.w2_name != '') && (dataRecord.w2_name != 'Geen mengwater')) { +console.log("calcWater() mixed " + dataRecord.w2_name); liters = dataRecord.w1_amount + dataRecord.w2_amount; calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium); magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium); @@ -3237,6 +3244,7 @@ total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity); ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters); } else { +console.log("calcWater() single"); liters = dataRecord.w1_amount; calcium = dataRecord.w1_calcium; magnesium = dataRecord.w1_magnesium; @@ -4049,6 +4057,7 @@ $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name); $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name); // Fix tap water if zero using mash infuse amount. +console.log("mash_infuse: " + mash_infuse + " w1: " + parseFloat($('#w1_amount').jqxNumberInput('decimal')) + " " + dataRecord.w1_amount); if (parseFloat($('#w1_amount').jqxNumberInput('decimal')) == 0 && mash_infuse > 0) { $('#w1_amount').val(mash_infuse); dataRecord.w1_amount = mash_infuse; @@ -5855,7 +5864,7 @@ $('#wg_amount').val(mash_infuse); console.log('new infuse amount: ' + mash_infuse); calcWater(); -// calcMash(); + calcMash(); } }); $('#wstep_infuse_temp').on('change', function(event) {