Reset mash measurement fields when a recipe is copied to a product.

Sat, 26 Nov 2022 15:11:46 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 26 Nov 2022 15:11:46 +0100
changeset 445
3dbebcd56406
parent 444
4f626d0bb4d4
child 446
f12becbdd042

Reset mash measurement fields when a recipe is copied to a product.

src/EditRecipeExport.cpp file | annotate | diff | comparison | revisions
--- a/src/EditRecipeExport.cpp	Sat Nov 19 13:55:12 2022 +0100
+++ b/src/EditRecipeExport.cpp	Sat Nov 26 15:11:46 2022 +0100
@@ -285,7 +285,7 @@
     p->birth = QDate::currentDate();
     p->stage = p->inventory_reduced = PROD_STAGE_PLAN;
     p->notes = recipe->notes;
-//    p->log_brew = p->log_fermentation = p->log_ispindel = p->log_co2pressure = p->locked = false;
+    p->log_brew = p->log_fermentation = p->log_ispindel = p->log_co2pressure = p->locked = false;
 
     p->st_name = recipe->st_name;
     p->st_letter = recipe->st_letter;
@@ -309,16 +309,13 @@
     p->eq_name = QString("Not yet set");
     p->eq_notes = QString("");
     p->eq_tun_specific_heat = 0.11;
-//    p->eq_tun_material = 0;
+    p->eq_tun_material = 0;
     p->eq_tun_volume = p->eq_tun_height = 20;
     p->eq_tun_weight = 2;
-//    p->eq_top_up_water = 0;
+    p->eq_top_up_water = 0;
     p->eq_trub_chiller_loss = 0.5;
     p->eq_evap_rate = 1.8;
-//    p->eq_calc_boil_volume = true;
-//    p->eq_top_up_kettle = 0;
-//    p->eq_hop_utilization = 100;
-//    p->eq_lauter_volume = p->eq_lauter_height
+    p->eq_top_up_kettle = 0;
     p->eq_kettle_volume = p->eq_kettle_height = p->eq_mash_volume = 20;
     p->eq_lauter_deadspace = 0.5;
     p->eq_mash_max = 6;
@@ -431,6 +428,13 @@
     p->miscs = recipe->miscs;
     p->yeasts = recipe->yeasts;
     p->mashs = recipe->mashs;
+    /*
+     * Reset measurement fields.
+     */
+    for (int i = 0; i < p->mashs.size(); i++) {
+	p->mashs[i].step_ph = 0;
+	p->mashs[i].step_sg = 0;
+    }
 
     if (DB_product::save(p, this)) {
         QMessageBox::information(this, tr("Copy Recipe"), tr("Copy Recipe to Product ready."));

mercurial