121 if ((rows = $('#mashGrid').jqxGrid('getrows'))) { |
121 if ((rows = $('#mashGrid').jqxGrid('getrows'))) { |
122 for (var i = 0; i < rows.length; i++) { |
122 for (var i = 0; i < rows.length; i++) { |
123 var row = rows[i]; |
123 var row = rows[i]; |
124 if (row.step_type == 0) // Infusion |
124 if (row.step_type == 0) // Infusion |
125 mvol += parseFloat(row.step_infuse_amount); |
125 mvol += parseFloat(row.step_infuse_amount); |
126 mashtime += row.step_time; |
126 if (row.step_temp <= 75) { // Ignore mashout |
127 mashtemp += row.step_time * row.step_temp; |
127 mashtime += row.step_time; |
|
128 mashtemp += row.step_time * row.step_temp; |
|
129 } |
128 } |
130 } |
129 mashtemp = mashtemp / mashtime; |
131 mashtemp = mashtemp / mashtime; |
130 console.log("mash time:"+mashtime+" temp:"+mashtemp); |
132 console.log("mash time:"+mashtime+" temp:"+mashtemp); |
131 } |
133 } |
132 |
134 |
250 $("#perc_sugars").jqxProgressBar('val', psugar); |
252 $("#perc_sugars").jqxProgressBar('val', psugar); |
251 $("#perc_cara").jqxProgressBar('val', pcara); |
253 $("#perc_cara").jqxProgressBar('val', pcara); |
252 calcStage(); |
254 calcStage(); |
253 |
255 |
254 // Calculate estimated svg. |
256 // Calculate estimated svg. |
255 svg = 77; // default. |
257 svg = 0; // default. |
256 var rows = $('#yeastGrid').jqxGrid('getrows'); |
258 var rows = $('#yeastGrid').jqxGrid('getrows'); |
257 for (var i = 0; i < rows.length; i++) { |
259 for (var i = 0; i < rows.length; i++) { |
258 var row = rows[i]; |
260 var row = rows[i]; |
259 if (row.y_use == 0) // Primary |
261 if (row.y_use == 0) { // Primary |
260 svg = parseFloat(row.y_attenuation); |
262 if (parseFloat(row.y_attenuation) > svg) |
261 } |
263 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts. |
|
264 } |
|
265 // TODO: brett in secondary ?? |
|
266 } |
|
267 if (svg == 0) |
|
268 svg = 77; |
262 |
269 |
263 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) { |
270 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) { |
264 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og); |
271 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og); |
265 } else { |
272 } else { |
266 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og); |
273 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og); |