# HG changeset patch # User Michiel Broek # Date 1667051008 -7200 # Node ID 1466eab37f53ceee923a6c23c811a7db1d9c24f1 # Parent 3c3d6585c3956ef383490eddb0106cbec0432d02 Fix false adjust_to_total_100 setting in priming fermentables. diff -r 3c3d6585c395 -r 1466eab37f53 src/EditProductTab11.cpp --- a/src/EditProductTab11.cpp Fri Oct 28 16:37:49 2022 +0200 +++ b/src/EditProductTab11.cpp Sat Oct 29 15:43:28 2022 +0200 @@ -416,25 +416,27 @@ query.next(); } - newf.name = query.value(0).toString(); - newf.origin = query.value(1).toString(); - newf.supplier = query.value(2).toString(); - newf.cost = query.value(3).toDouble(); - newf.type = query.value(4).toInt(); - newf.yield = query.value(5).toDouble(); - newf.color = query.value(6).toDouble(); - newf.coarse_fine_diff = query.value(7).toDouble(); - newf.moisture = query.value(8).toDouble(); - newf.diastatic_power = query.value(9).toDouble(); - newf.protein = query.value(10).toDouble(); - newf.dissolved_protein = query.value(11).toDouble(); - newf.max_in_batch = query.value(12).toDouble(); - newf.graintype = query.value(13).toInt(); - newf.recommend_mash = query.value(14).toInt() ? true:false; + newf.name = query.value("name").toString(); + newf.origin = query.value("origin").toString(); + newf.supplier = query.value("supplier").toString(); + newf.cost = query.value("cost").toDouble(); + newf.type = query.value("type").toInt(); + newf.yield = query.value("yield").toDouble(); + newf.color = query.value("color").toDouble(); + newf.coarse_fine_diff = query.value("coarse_fine_diff").toDouble(); + newf.moisture = query.value("moisture").toDouble(); + newf.diastatic_power = query.value("diastatic_power").toDouble(); + newf.protein = query.value("protein").toDouble(); + newf.dissolved_protein = query.value("dissolved_protein").toDouble(); + newf.max_in_batch = query.value("max_in_batch").toDouble(); + newf.graintype = query.value("graintype").toInt(); + newf.recommend_mash = query.value("recommend_mash").toInt() ? true:false; newf.add_after_boil = true; - newf.di_ph = query.value(16).toDouble(); - newf.acid_to_ph_57 = query.value(17).toDouble(); - newf.inventory = query.value(18).toDouble(); + newf.di_ph = query.value("di_ph").toDouble(); + newf.acid_to_ph_57 = query.value("acid_to_ph_57").toDouble(); + newf.inventory = query.value("inventory").toDouble(); + newf.adjust_to_total_100 = false; + newf.percentage = 0; newf.amount = 0; newf.added = FERMENTABLE_ADDED_BOTTLE; @@ -522,25 +524,27 @@ query.next(); } - newf.name = query.value(0).toString(); - newf.origin = query.value(1).toString(); - newf.supplier = query.value(2).toString(); - newf.cost = query.value(3).toDouble(); - newf.type = query.value(4).toInt(); - newf.yield = query.value(5).toDouble(); - newf.color = query.value(6).toDouble(); - newf.coarse_fine_diff = query.value(7).toDouble(); - newf.moisture = query.value(8).toDouble(); - newf.diastatic_power = query.value(9).toDouble(); - newf.protein = query.value(10).toDouble(); - newf.dissolved_protein = query.value(11).toDouble(); - newf.max_in_batch = query.value(12).toDouble(); - newf.graintype = query.value(13).toInt(); - newf.recommend_mash = query.value(14).toInt() ? true:false; + newf.name = query.value("name").toString(); + newf.origin = query.value("origin").toString(); + newf.supplier = query.value("supplier").toString(); + newf.cost = query.value("cost").toDouble(); + newf.type = query.value("type").toInt(); + newf.yield = query.value("yield").toDouble(); + newf.color = query.value("color").toDouble(); + newf.coarse_fine_diff = query.value("coarse_fine_diff").toDouble(); + newf.moisture = query.value("moisture").toDouble(); + newf.diastatic_power = query.value("diastatic_power").toDouble(); + newf.protein = query.value("protein").toDouble(); + newf.dissolved_protein = query.value("dissolved_protein").toDouble(); + newf.max_in_batch = query.value("max_in_batch").toDouble(); + newf.graintype = query.value("graintype").toInt(); + newf.recommend_mash = query.value("recommend_mash").toInt() ? true:false; newf.add_after_boil = true; - newf.di_ph = query.value(16).toDouble(); - newf.acid_to_ph_57 = query.value(17).toDouble(); - newf.inventory = query.value(18).toDouble(); + newf.di_ph = query.value("di_ph").toDouble(); + newf.acid_to_ph_57 = query.value("acid_to_ph_57").toDouble(); + newf.inventory = query.value("inventory").toDouble(); + newf.adjust_to_total_100 = false; + newf.percentage = 0; newf.amount = 0; newf.added = FERMENTABLE_ADDED_KEGS; diff -r 3c3d6585c395 -r 1466eab37f53 src/EditProductTab3.cpp --- a/src/EditProductTab3.cpp Fri Oct 28 16:37:49 2022 +0200 +++ b/src/EditProductTab3.cpp Sat Oct 29 15:43:28 2022 +0200 @@ -260,6 +260,7 @@ const QSignalBlocker blocker1(ui->est_ogEdit); const QSignalBlocker blocker2(ui->est_og2Edit); + product->fermentables_use100 = false; if (product->fermentables.size() < 1) { qDebug() << " no fermentables, return."; product->est_og = 0.980; @@ -290,11 +291,12 @@ ui->mash_kgEdit->setValue(0); return; } - qDebug() << " adjust to 100" << product->fermentables_use100; product->fermentables_ok = true; product->mashs_kg = 0; for (i = 0; i < product->fermentables.size(); i++) { + if (product->fermentables.at(i).adjust_to_total_100 && product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) + product->fermentables_use100 = true; if (product->fermentables.at(i).type == FERMENTABLE_TYPE_SUGAR && product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) psugar += product->fermentables.at(i).percentage; if (product->fermentables.at(i).graintype == FERMENTABLE_GRAINTYPE_CRYSTAL && product->fermentables.at(i).added < FERMENTABLE_ADDED_BOTTLE) @@ -336,6 +338,7 @@ product->fermentables_ok = false; } } + qDebug() << " adjust to 100" << product->fermentables_use100; qDebug() << " supplies" << product->fermentables_ok; qDebug() << " colort" << colort << "colorh" << colorh << "colorn" << colorn; qDebug() << " psugar" << psugar << "pcara" << pcara << "mvol" << mvol;