# HG changeset patch # User Michiel Broek # Date 1659093624 -7200 # Node ID 74d541ac514cf21c11a007aeed6394a69b5ca5dc # Parent b02aca4e926ce4627a97a08b1eeb45a5c9225696 Update recipe load/save for the new hops fields. diff -r b02aca4e926c -r 74d541ac514c src/database/db_recipe.cpp --- a/src/database/db_recipe.cpp Fri Jul 29 13:12:26 2022 +0200 +++ b/src/database/db_recipe.cpp Fri Jul 29 13:20:24 2022 +0200 @@ -209,6 +209,19 @@ h.cohumulone = obj["h_cohumulone"].toDouble(); h.myrcene = obj["h_myrcene"].toDouble(); h.total_oil = obj["h_total_oil"].toDouble(); + h.utilisation = obj["h_utilisation"].toDouble(); + h.bu_factor = obj["h_bu_factor"].toDouble(); + /* Update */ + if (h.utilisation == 0 || h.bu_factor == 0) { + yquery.prepare("SELECT utilisation,bu_factor FROM inventory_hops WHERE name=:name AND origin=:origin"); + yquery.bindValue(":name", h.name); + yquery.bindValue(":origin", h.origin); + yquery.exec(); + if (yquery.first()) { + h.utilisation = yquery.value("utilisation").toDouble(); + h.bu_factor = yquery.value("bu_factor").toDouble(); + } + } reci->hops.append(h); } } @@ -536,6 +549,8 @@ obj.insert("h_cohumulone", round(reci->hops.at(i).cohumulone * 100) / 100); obj.insert("h_myrcene", round(reci->hops.at(i).myrcene * 100) / 100); obj.insert("h_total_oil", round(reci->hops.at(i).total_oil * 100) / 100); + obj.insert("h_utilisation", round(reci->hops.at(i).utilisation * 100) / 100); + obj.insert("h_bu_factor", round(reci->hops.at(i).bu_factor * 100) / 100); array.append(obj); /* Append this object */ } QJsonDocument doc;