# HG changeset patch # User Michiel Broek # Date 1549018718 -3600 # Node ID fd6d87d1c9ed4bda61a654435e07b3bc1f7c2ea0 # Parent 40e68b18b50d40c2223eae81a34e0d5c2814225c Recalculate FG, SVG and ABV when changing the primary yeast. diff -r 40e68b18b50d -r fd6d87d1c9ed www/js/rec_edit.js --- a/www/js/rec_edit.js Thu Jan 31 22:39:36 2019 +0100 +++ b/www/js/rec_edit.js Fri Feb 01 11:58:38 2019 +0100 @@ -1009,8 +1009,17 @@ //CalcWaterBalance; }; + function calcFG() { + var fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, parseFloat(parseFloat($("#est_og").jqxNumberInput('decimal')))); + dataRecord.est_fg = fg; + $('#est_fg').val(fg); + $('#est_fg2').val(fg); + } + function calcABV() { - $("#est_abv").val(abvol(parseFloat($("#est_og").jqxNumberInput('decimal')), parseFloat($("#est_fg").jqxNumberInput('decimal')))); + var abv = abvol(parseFloat($("#est_og").jqxNumberInput('decimal')), parseFloat($("#est_fg").jqxNumberInput('decimal'))); + $("#est_abv").val(abv); + $("#est_abv2").val(abv); }; function calcInit () { @@ -1104,6 +1113,7 @@ calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG calcFermentables(); calcSVG(); + calcFG(); calcABV(); // TODO: adjust the hops, miscs, yeast, water. calcIBUs(); @@ -1119,6 +1129,7 @@ $("#boil_size").val(Math.round(new_boil * 100) / 100); calcFermentables(); calcSVG(); + calcFG(); calcABV(); // TODO: adjust the hops, miscs, yeast, water. calcIBUs(); @@ -1127,6 +1138,7 @@ console.log("efficiency change:"+event.args.value); calcFermentables(); calcSVG(); + calcFG(); calcABV(); calcIBUs(); }); @@ -1135,6 +1147,7 @@ calcFermentablesFromOG(event.args.value); // Adjust fermentables amounts calcFermentables(); // Update the recipe details calcSVG(); + calcFG(); calcABV(); // and ABV calcIBUs(); // and the IBU's. }); @@ -1324,11 +1337,13 @@ $("#st_og_min").val(dataRecord.st_og_min); $("#st_og_max").val(dataRecord.st_og_max); $("#est_fg").val(dataRecord.est_fg); + $("#est_fg2").val(dataRecord.est_fg); $("#st_fg_min").val(dataRecord.st_fg_min); $("#st_fg_max").val(dataRecord.st_fg_max); $("#est_color").val(dataRecord.est_color); $("#est_color2").val(dataRecord.est_color); $("#est_abv").val(dataRecord.est_abv); + $("#est_abv2").val(dataRecord.est_abv); $("#st_abv_min").val(dataRecord.st_abv_min); $("#st_abv_max").val(dataRecord.st_abv_max); $("#st_color_min").val(dataRecord.st_color_min); @@ -1552,6 +1567,7 @@ } calcFermentables(); calcSVG(); + calcFG(); calcABV(); calcIBUs(); }); @@ -2050,7 +2066,7 @@ var yeastAdapter = new $.jqx.dataAdapter(yeastSource); $("#yeastGrid").jqxGrid({ width: 1240, - height: 525, + height: 400, source: yeastAdapter, theme: theme, selectionmode: 'singlerow', @@ -2189,7 +2205,6 @@ } ] }); -// $("#yeastGrid").jqxGrid('setcellvalue', args.rowindex, 'y_amount', parseFloat(args.value * 0.0588)); }; // inline mash editor @@ -2270,9 +2285,7 @@ }); }, ready: function() { - var fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, parseFloat(parseFloat($("#est_og").jqxNumberInput('decimal')))); - dataRecord.est_fg = fg; - $('#est_fg').val(fg); + calcFG(); calcInit(); $('#jqxLoader').jqxLoader('close'); $('#jqxTabs').jqxTabs('first'); @@ -2464,6 +2477,7 @@ // Recalc percentages calcFermentables(); calcSVG(); + calcFG(); calcABV(); calcIBUs(); // Waters: yes there is impact. @@ -2872,6 +2886,10 @@ }); // Tab 5, Gist + $("#est_fg2").jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); + $("#est_fg2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); + $("#est_abv2").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true }); $("#popupYeast").jqxWindow({ width: 800, height: 300, @@ -2885,6 +2903,9 @@ }); $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); $("#YeastReady").click(function () { + calcSVG(); + calcFG(); + calcABV(); $("#yeastGrid").jqxGrid('sortby', 'y_use', 'asc'); }); $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); @@ -2936,6 +2957,9 @@ } else { $("#wy_pmpt_amount").html("Volume ml:"); } + calcSVG(); + calcFG(); + calcABV(); } }); $("#wy_amount").jqxNumberInput( Spin1dec5 ); @@ -2947,6 +2971,9 @@ else var amount = parseFloat(event.args.value) / 1000; rowdata.y_amount = amount; + calcSVG(); + calcFG(); + calcABV(); }); $("#wy_use").jqxDropDownList({ theme: theme, @@ -2963,6 +2990,9 @@ var index = event.args.index; var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); rowdata.y_use = index; + calcSVG(); + calcFG(); + calcABV(); } }); diff -r 40e68b18b50d -r fd6d87d1c9ed www/rec_edit.php --- a/www/rec_edit.php Thu Jan 31 22:39:36 2019 +0100 +++ b/www/rec_edit.php Fri Feb 01 11:58:38 2019 +0100 @@ -69,9 +69,9 @@
- Start SG: + Verwacht start SG:
- Eind SG: + Verwacht eind SG:
Alcohol vol%:
@@ -160,8 +160,14 @@
- - + + + + + + + +
 
Verwacht eind SG:
Verwacht ABV %: