Mon, 13 Jun 2022 17:34:51 +0200
Member names for yeasts normalized.
--- a/src/EditProductExport.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/EditProductExport.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -186,17 +186,17 @@ for (int i = 0; i < product->yeasts.size(); i++) { xmlWriter->writeStartElement("YEAST"); xmlWriter->writeTextElement("VERSION", "1"); - xmlWriter->writeTextElement("NAME", product->yeasts.at(i).y_name); - xmlWriter->writeTextElement("TYPE", yeast_type[product->yeasts.at(i).y_type]); - xmlWriter->writeTextElement("FORM", yeast_form[product->yeasts.at(i).y_form]); - xmlWriter->writeTextElement("AMOUNT", QString::number(product->yeasts.at(i).y_amount, 'f', 5)); - xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", (product->yeasts.at(i).y_form == 1) ? "TRUE":"FALSE"); - xmlWriter->writeTextElement("LABORATORY", product->yeasts.at(i).y_laboratory); - xmlWriter->writeTextElement("PRODUCT_ID", product->yeasts.at(i).y_product_id); - xmlWriter->writeTextElement("MIN_TEMPERATURE", QString::number(product->yeasts.at(i).y_min_temperature, 'f', 1)); - xmlWriter->writeTextElement("MAX_TEMPERATURE", QString::number(product->yeasts.at(i).y_max_temperature, 'f', 1)); - xmlWriter->writeTextElement("ATTENUATION", QString::number(product->yeasts.at(i).y_attenuation, 'f', 1)); - xmlWriter->writeTextElement("ADD_TO_SECONDARY", (product->yeasts.at(i).y_use == 0) ? "FALSE":"TRUE"); + xmlWriter->writeTextElement("NAME", product->yeasts.at(i).name); + xmlWriter->writeTextElement("TYPE", yeast_type[product->yeasts.at(i).type]); + xmlWriter->writeTextElement("FORM", yeast_form[product->yeasts.at(i).form]); + xmlWriter->writeTextElement("AMOUNT", QString::number(product->yeasts.at(i).amount, 'f', 5)); + xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", (product->yeasts.at(i).form == 1) ? "TRUE":"FALSE"); + xmlWriter->writeTextElement("LABORATORY", product->yeasts.at(i).laboratory); + xmlWriter->writeTextElement("PRODUCT_ID", product->yeasts.at(i).product_id); + xmlWriter->writeTextElement("MIN_TEMPERATURE", QString::number(product->yeasts.at(i).min_temperature, 'f', 1)); + xmlWriter->writeTextElement("MAX_TEMPERATURE", QString::number(product->yeasts.at(i).max_temperature, 'f', 1)); + xmlWriter->writeTextElement("ATTENUATION", QString::number(product->yeasts.at(i).attenuation, 'f', 1)); + xmlWriter->writeTextElement("ADD_TO_SECONDARY", (product->yeasts.at(i).use == 0) ? "FALSE":"TRUE"); xmlWriter->writeEndElement(); } xmlWriter->writeEndElement(); // YEASTS @@ -506,16 +506,16 @@ memo.append("[tabular]\n"); memo.append("[head]Gistlab en code[/head][head]Omschrijving[/head][head]Gebruik[/head][head]Vorm[/head][head]Hoeveel[/head]\n"); for (int i = 0; i < product->yeasts.size(); i++) { - memo.append("[row][data]" + product->yeasts.at(i).y_laboratory + " " + product->yeasts.at(i).y_product_id + "[/data]"); - memo.append("[data]" + product->yeasts.at(i).y_name + "[/data]"); - memo.append("[data]" + yeast_use[product->yeasts.at(i).y_use] + "[/data]"); - memo.append("[data]" + yeast_form[product->yeasts.at(i).y_form] + "[/data]"); - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) - memo.append("[data]" + QString::number(product->yeasts.at(i).y_amount, 'f', 0) + " pak[/data][/row]\n"); - else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) - memo.append("[data]" + QString::number(product->yeasts.at(i).y_amount * 1000, 'f', 1) + " gr[/data][/row]\n"); + memo.append("[row][data]" + product->yeasts.at(i).laboratory + " " + product->yeasts.at(i).product_id + "[/data]"); + memo.append("[data]" + product->yeasts.at(i).name + "[/data]"); + memo.append("[data]" + yeast_use[product->yeasts.at(i).use] + "[/data]"); + memo.append("[data]" + yeast_form[product->yeasts.at(i).form] + "[/data]"); + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) + memo.append("[data]" + QString::number(product->yeasts.at(i).amount, 'f', 0) + " pak[/data][/row]\n"); + else if (product->yeasts.at(i).form == YEAST_FORMS_DRY || product->yeasts.at(i).form == YEAST_FORMS_DRIED) + memo.append("[data]" + QString::number(product->yeasts.at(i).amount * 1000, 'f', 1) + " gr[/data][/row]\n"); else - memo.append("[data]" + QString::number(product->yeasts.at(i).y_amount * 1000, 'f', 0) + " ml[/data][/row]\n"); + memo.append("[data]" + QString::number(product->yeasts.at(i).amount * 1000, 'f', 0) + " ml[/data][/row]\n"); } memo.append("[/tabular]\n"); if (product->starter_enable) { @@ -935,7 +935,7 @@ sp->miscs[j].amount = round(sp->miscs.at(j).amount * factor * 100000) / 100000; } for (int j = 0; j < sp->yeasts.size(); j++) { - sp->yeasts[j].y_amount = round(sp->yeasts.at(j).y_amount * factor * 100000) / 100000; + sp->yeasts[j].amount = round(sp->yeasts.at(j).amount * factor * 100000) / 100000; } for (int j = 0; j < sp->mashs.size(); j++) { sp->mashs[j].step_volume = round(sp->mashs.at(j).step_volume * factor * 100) / 100; @@ -992,7 +992,7 @@ sp->miscs[j].amount = round(sp->miscs.at(j).amount * factor * 100000) / 100000; } for (int j = 0; j < sp->yeasts.size(); j++) { - sp->yeasts[j].y_amount = round(sp->yeasts.at(j).y_amount * factor * 100000) / 100000; + sp->yeasts[j].amount = round(sp->yeasts.at(j).amount * factor * 100000) / 100000; } for (int j = 0; j < sp->mashs.size(); j++) { sp->mashs[j].step_volume = round(sp->mashs.at(j).step_volume * factor * 100) / 100; @@ -1029,14 +1029,14 @@ beerxmlButton->setObjectName(QString::fromUtf8("beerxmlButton")); beerxmlButton->setGeometry(QRect(50, 20, 171, 21)); beerxmlButton->setText(tr("Export to beerXML")); - QRadioButton *copy_productButton = new QRadioButton(dialog); - copy_productButton->setObjectName(QString::fromUtf8("copy_productButton")); - copy_productButton->setGeometry(QRect(50, 50, 171, 21)); - copy_productButton->setText(tr("Copy to product")); - QRadioButton *copy_recipeButton = new QRadioButton(dialog); - copy_recipeButton->setObjectName(QString::fromUtf8("copy_recipeButton")); - copy_recipeButton->setGeometry(QRect(50, 80, 171, 21)); - copy_recipeButton->setText(tr("Copy to recipe")); + QRadioButton *copproductButton = new QRadioButton(dialog); + copproductButton->setObjectName(QString::fromUtf8("copproductButton")); + copproductButton->setGeometry(QRect(50, 50, 171, 21)); + copproductButton->setText(tr("Copy to product")); + QRadioButton *coprecipeButton = new QRadioButton(dialog); + coprecipeButton->setObjectName(QString::fromUtf8("coprecipeButton")); + coprecipeButton->setGeometry(QRect(50, 80, 171, 21)); + coprecipeButton->setText(tr("Copy to recipe")); QRadioButton *toforumButton = new QRadioButton(dialog); toforumButton->setObjectName(QString::fromUtf8("toforumButton")); toforumButton->setGeometry(QRect(50, 110, 171, 21)); @@ -1056,9 +1056,9 @@ if (dialog->result() == QDialog::Accepted) { if (beerxmlButton->isChecked()) exportBeerXML(); - if (copy_productButton->isChecked()) + if (copproductButton->isChecked()) copyProduct(); - if (copy_recipeButton->isChecked()) + if (coprecipeButton->isChecked()) copyRecipe(); if (toforumButton->isChecked()) toforumProduct();
--- a/src/EditProductTab3.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/EditProductTab3.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -398,20 +398,20 @@ product->yeasts_ok = true; if (product->yeasts.size() > 0) { for (i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == 0) { // Used in primary - if (product->yeasts.at(i).y_attenuation > svg) - svg = product->yeasts.at(i).y_attenuation; // Take the highest if multiple yeasts. + if (product->yeasts.at(i).use == 0) { // Used in primary + if (product->yeasts.at(i).attenuation > svg) + svg = product->yeasts.at(i).attenuation; // Take the highest if multiple yeasts. } - if (product->yeasts.at(i).y_form == 0) - initcells += (product->yeasts.at(i).y_cells / 1000000000) * product->yeasts.at(i).y_amount * (product->starter_viability / 100); + if (product->yeasts.at(i).form == 0) + initcells += (product->yeasts.at(i).cells / 1000000000) * product->yeasts.at(i).amount * (product->starter_viability / 100); else - initcells += (product->yeasts.at(i).y_cells / 1000000) * product->yeasts.at(i).y_amount * (product->starter_viability / 100); + initcells += (product->yeasts.at(i).cells / 1000000) * product->yeasts.at(i).amount * (product->starter_viability / 100); // TODO: brett or others in secondary. - if ((((product->inventory_reduced <= PROD_STAGE_PRIMARY) && (product->yeasts.at(i).y_use == 0)) || // Primary - ((product->inventory_reduced <= PROD_STAGE_SECONDARY) && (product->yeasts.at(i).y_use == 1)) || // Secondary - ((product->inventory_reduced <= PROD_STAGE_TERTIARY) && (product->yeasts.at(i).y_use == 2)) || // Tertiary - ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->yeasts.at(i).y_use == 3))) && // Bottle - (product->yeasts.at(i).y_inventory < product->yeasts.at(i).y_amount)) { + if ((((product->inventory_reduced <= PROD_STAGE_PRIMARY) && (product->yeasts.at(i).use == 0)) || // Primary + ((product->inventory_reduced <= PROD_STAGE_SECONDARY) && (product->yeasts.at(i).use == 1)) || // Secondary + ((product->inventory_reduced <= PROD_STAGE_TERTIARY) && (product->yeasts.at(i).use == 2)) || // Tertiary + ((product->inventory_reduced <= PROD_STAGE_PACKAGE) && (product->yeasts.at(i).use == 3))) && // Bottle + (product->yeasts.at(i).inventory < product->yeasts.at(i).amount)) { product->yeasts_ok = false; } }
--- a/src/EditProductTab6.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/EditProductTab6.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -20,11 +20,11 @@ bool EditProduct::yeast_sort_test(const Yeasts &D1, const Yeasts &D2) { - if (D1.y_use > D2.y_use) + if (D1.use > D2.use) return false; - if (D1.y_use < D2.y_use) + if (D1.use < D2.use) return true; - return (D1.y_amount > D2.y_amount); + return (D1.amount > D2.amount); } @@ -61,51 +61,51 @@ for (int i = 0; i < product->yeasts.size(); i++) { - ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(product->yeasts.at(i).y_name)); - ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(product->yeasts.at(i).y_laboratory)); - ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(product->yeasts.at(i).y_product_id)); + ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(product->yeasts.at(i).name)); + ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(product->yeasts.at(i).laboratory)); + ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(product->yeasts.at(i).product_id)); - item = new QTableWidgetItem(yeast_forms[product->yeasts.at(i).y_form]); + item = new QTableWidgetItem(yeast_forms[product->yeasts.at(i).form]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 3, item); - item = new QTableWidgetItem(yeast_use[product->yeasts.at(i).y_use]); + item = new QTableWidgetItem(yeast_use[product->yeasts.at(i).use]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 4, item); - item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).y_min_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).min_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 5, item); - item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).y_max_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1°C").arg(product->yeasts.at(i).max_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 6, item); - item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).y_tolerance, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).tolerance, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 7, item); - item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).y_attenuation, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1%").arg(product->yeasts.at(i).attenuation, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 8, item); - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) - item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).y_amount, 1, 'f', 0, '0')); - else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) - item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) + item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).amount, 1, 'f', 0, '0')); + else if (product->yeasts.at(i).form == YEAST_FORMS_DRY || product->yeasts.at(i).form == YEAST_FORMS_DRIED) + item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); else - item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); + item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 9, item); - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) - item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).y_inventory, 1, 'f', 0, '0')); - else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY || product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) - item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).y_inventory * 1000.0, 3, 'f', 2, '0')); + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) + item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(i).inventory, 1, 'f', 0, '0')); + else if (product->yeasts.at(i).form == YEAST_FORMS_DRY || product->yeasts.at(i).form == YEAST_FORMS_DRIED) + item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(i).inventory * 1000.0, 3, 'f', 2, '0')); else - item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).y_inventory * 1000.0, 3, 'f', 2, '0')); + item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(i).inventory * 1000.0, 3, 'f', 2, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); - if (product->yeasts.at(i).y_inventory < product->yeasts.at(i).y_amount) + if (product->yeasts.at(i).inventory < product->yeasts.at(i).amount) item->setForeground(QBrush(QColor(Qt::red))); ui->yeastsTable->setItem(i, 10, item); @@ -187,25 +187,25 @@ calcViability(); for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { // Primary - if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { + if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { // Primary + if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { /* * Dry yeast, build the formule with the yeast parameters. * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ */ ui->yeastProcedure->setCurrentIndex(2); - ui->lo_gr_hlEdit->setValue(product->yeasts.at(i).y_gr_hl_lo); - ui->hi_gr_hlEdit->setValue(product->yeasts.at(i).y_gr_hl_hi); - ui->lo_sgEdit->setValue(product->yeasts.at(i).y_sg_lo); - ui->hi_sgEdit->setValue(product->yeasts.at(i).y_sg_hi); - double og = product->yeasts.at(i).y_sg_lo; - double f1 = product->yeasts.at(i).y_gr_hl_lo / 100.0; + ui->lo_gr_hlEdit->setValue(product->yeasts.at(i).gr_hl_lo); + ui->hi_gr_hlEdit->setValue(product->yeasts.at(i).gr_hl_hi); + ui->lo_sgEdit->setValue(product->yeasts.at(i).sg_lo); + ui->hi_sgEdit->setValue(product->yeasts.at(i).sg_hi); + double og = product->yeasts.at(i).sg_lo; + double f1 = product->yeasts.at(i).gr_hl_lo / 100.0; double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; double yeast_grams = round(volume * multiplier * 100.0) / product->starter_viability; double yeast_gr_hl = round((yeast_grams / (volume * 0.01)) * 100.0) / 100.0; - double pitch_gr_hl = round(((product->yeasts.at(i).y_amount * 1000.0) / (volume * 0.01)) * 100.0) / 100.0; + double pitch_gr_hl = round(((product->yeasts.at(i).amount * 1000.0) / (volume * 0.01)) * 100.0) / 100.0; ui->dry_needShow->setValue(yeast_grams); ui->dry_pitchrateShow->setValue(yeast_gr_hl); ui->pitch_grShow->setValue(pitch_gr_hl); @@ -224,11 +224,11 @@ /* * No pitchrate yet, do a educated guess .. */ - if (product->yeasts.at(i).y_type == YEAST_TYPES_LAGER) { + if (product->yeasts.at(i).type == YEAST_TYPES_LAGER) { product->yeast_pitchrate = 1.5; if (sg > 1.060) product->yeast_pitchrate = 2.0; - } else if (product->yeasts.at(i).y_type == YEAST_TYPES_KVEIK) { // Real Kveik + } else if (product->yeasts.at(i).type == YEAST_TYPES_KVEIK) { // Real Kveik product->yeast_pitchrate = 0.075; } else { product->yeast_pitchrate = 0.75; @@ -239,9 +239,9 @@ ui->pitchrateEdit->setValue(product->yeast_pitchrate); } - initcells = (product->yeasts.at(i).y_cells / 1000000) * product->yeasts.at(i).y_amount * (product->starter_viability / 100.0); - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) - initcells = (product->yeasts.at(i).y_cells / 1000000000) * product->yeasts.at(i).y_amount * (product->starter_viability / 100.0); + initcells = (product->yeasts.at(i).cells / 1000000) * product->yeasts.at(i).amount * (product->starter_viability / 100.0); + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) + initcells = (product->yeasts.at(i).cells / 1000000000) * product->yeasts.at(i).amount * (product->starter_viability / 100.0); needed = round(product->yeast_pitchrate * volume * plato * 10.0) / 10.0; ui->neededShow->setValue(needed); @@ -507,18 +507,18 @@ double max = 100; for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { + if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) { vpm = 0.80; max = 97; - if (product->yeasts.at(i).y_laboratory == "White Labs") { // PurePitch + if (product->yeasts.at(i).laboratory == "White Labs") { // PurePitch vpm = 0.95; max = 100; } - } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { + } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { vpm = 0.998; max = 100; - } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) { // dried kveik + } else if (product->yeasts.at(i).form == YEAST_FORMS_DRIED) { // dried kveik vpm = 0.92; max = 100; } else { // Slant, Culture, Frozen, Bottle @@ -670,36 +670,36 @@ qDebug() << "Add yeast row"; for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_amount == 0) + if (product->yeasts.at(i).amount == 0) return; // Add only one at a time. } - newy.y_name = "Select one"; - newy.y_laboratory = ""; - newy.y_product_id = ""; - newy.y_amount = 0; - newy.y_type = YEAST_TYPES_ALE; - newy.y_form = YEAST_FORMS_LIQUID; - newy.y_min_temperature = 0; - newy.y_max_temperature = 0; - newy.y_flocculation = 0; - newy.y_attenuation = 0; - newy.y_cells = 0; - newy.y_tolerance = 0; - newy.y_inventory = 0; - newy.y_use = YEAST_USE_PRIMARY; - newy.y_sta1 = false; - newy.y_bacteria = false; - newy.y_harvest_top = false; - newy.y_harvest_time = 0; - newy.y_pitch_temperature = 0; - newy.y_pofpos = false; - newy.y_zymocide = 0; - newy.y_gr_hl_lo = 0; - newy.y_sg_lo = 0; - newy.y_gr_hl_hi = 0; - newy.y_sg_hi = 0; - newy.y_cost = 0; + newy.name = "Select one"; + newy.laboratory = ""; + newy.product_id = ""; + newy.amount = 0; + newy.type = YEAST_TYPES_ALE; + newy.form = YEAST_FORMS_LIQUID; + newy.min_temperature = 0; + newy.max_temperature = 0; + newy.flocculation = 0; + newy.attenuation = 0; + newy.cells = 0; + newy.tolerance = 0; + newy.inventory = 0; + newy.use = YEAST_USE_PRIMARY; + newy.sta1 = false; + newy.bacteria = false; + newy.harvest_top = false; + newy.harvest_time = 0; + newy.pitch_temperature = 0; + newy.pofpos = false; + newy.zymocide = 0; + newy.gr_hl_lo = 0; + newy.sg_lo = 0; + newy.gr_hl_hi = 0; + newy.sg_hi = 0; + newy.cost = 0; product->yeasts.append(newy); emit refreshAll(); @@ -715,7 +715,7 @@ int row = pb->objectName().toInt(); qDebug() << "Delete yeast row" << row << product->yeasts.size(); - int rc = QMessageBox::warning(this, tr("Delete yeast"), tr("Delete %1").arg(product->yeasts.at(row).y_name), + int rc = QMessageBox::warning(this, tr("Delete yeast"), tr("Delete %1").arg(product->yeasts.at(row).name), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (rc == QMessageBox::No) return; @@ -732,15 +732,15 @@ qDebug() << "yeast_amount_changed()" << product->yeasts_row << val; - if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) { - product->yeasts[product->yeasts_row].y_amount = val; + if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) { + product->yeasts[product->yeasts_row].amount = val; item = new QTableWidgetItem(QString("%1 pack").arg(val, 1, 'f', 0, '0')); - } else if ((product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY) || - (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED)) { - product->yeasts[product->yeasts_row].y_amount = val / 1000.0; + } else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || + (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) { + product->yeasts[product->yeasts_row].amount = val / 1000.0; item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0')); } else { - product->yeasts[product->yeasts_row].y_amount = val / 1000.0; + product->yeasts[product->yeasts_row].amount = val / 1000.0; item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0')); } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -757,7 +757,7 @@ bool instock = yinstockEdit->isChecked(); QString w; QTableWidgetItem *item; - int oldform = product->yeasts.at(product->yeasts_row).y_form; + int oldform = product->yeasts.at(product->yeasts_row).form; if (val < 1) return; @@ -769,7 +769,7 @@ */ QString sql = "SELECT name,laboratory,product_id,type,form,min_temperature,max_temperature,flocculation,attenuation," "cells,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide," - "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost,inventory FROM inventory_yeasts "; + "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost,inventory FROM inventoryeasts "; if (instock) sql.append("WHERE inventory > 0 "); sql.append("ORDER BY laboratory,product_id,name"); @@ -784,91 +784,91 @@ /* * Replace the yeast record contents */ - product->yeasts[product->yeasts_row].y_name = query.value(0).toString(); - product->yeasts[product->yeasts_row].y_laboratory = query.value(1).toString(); - product->yeasts[product->yeasts_row].y_product_id = query.value(2).toString(); - product->yeasts[product->yeasts_row].y_type = query.value(3).toInt(); - product->yeasts[product->yeasts_row].y_form = query.value(4).toInt(); - product->yeasts[product->yeasts_row].y_min_temperature = query.value(5).toDouble(); - product->yeasts[product->yeasts_row].y_max_temperature = query.value(6).toDouble(); - product->yeasts[product->yeasts_row].y_flocculation = query.value(7).toInt(); - product->yeasts[product->yeasts_row].y_attenuation = query.value(8).toDouble(); - product->yeasts[product->yeasts_row].y_cells = query.value(9).toDouble(); - product->yeasts[product->yeasts_row].y_tolerance = query.value(10).toDouble(); - product->yeasts[product->yeasts_row].y_sta1 = query.value(11).toInt() ? true:false; - product->yeasts[product->yeasts_row].y_bacteria = query.value(12).toInt() ? true:false; - product->yeasts[product->yeasts_row].y_harvest_top = query.value(13).toInt() ? true:false; - product->yeasts[product->yeasts_row].y_harvest_time = query.value(14).toInt(); - product->yeasts[product->yeasts_row].y_pitch_temperature = query.value(15).toDouble(); - product->yeasts[product->yeasts_row].y_pofpos = query.value(16).toInt() ? true:false; - product->yeasts[product->yeasts_row].y_zymocide = query.value(17).toInt(); - product->yeasts[product->yeasts_row].y_gr_hl_lo = query.value(18).toInt(); - product->yeasts[product->yeasts_row].y_sg_lo = query.value(19).toDouble(); - product->yeasts[product->yeasts_row].y_gr_hl_hi = query.value(20).toInt(); - product->yeasts[product->yeasts_row].y_sg_hi = query.value(21).toDouble(); - product->yeasts[product->yeasts_row].y_cost = query.value(22).toDouble(); - product->yeasts[product->yeasts_row].y_inventory = query.value(23).toDouble(); + product->yeasts[product->yeasts_row].name = query.value(0).toString(); + product->yeasts[product->yeasts_row].laboratory = query.value(1).toString(); + product->yeasts[product->yeasts_row].product_id = query.value(2).toString(); + product->yeasts[product->yeasts_row].type = query.value(3).toInt(); + product->yeasts[product->yeasts_row].form = query.value(4).toInt(); + product->yeasts[product->yeasts_row].min_temperature = query.value(5).toDouble(); + product->yeasts[product->yeasts_row].max_temperature = query.value(6).toDouble(); + product->yeasts[product->yeasts_row].flocculation = query.value(7).toInt(); + product->yeasts[product->yeasts_row].attenuation = query.value(8).toDouble(); + product->yeasts[product->yeasts_row].cells = query.value(9).toDouble(); + product->yeasts[product->yeasts_row].tolerance = query.value(10).toDouble(); + product->yeasts[product->yeasts_row].sta1 = query.value(11).toInt() ? true:false; + product->yeasts[product->yeasts_row].bacteria = query.value(12).toInt() ? true:false; + product->yeasts[product->yeasts_row].harvest_top = query.value(13).toInt() ? true:false; + product->yeasts[product->yeasts_row].harvest_time = query.value(14).toInt(); + product->yeasts[product->yeasts_row].pitch_temperature = query.value(15).toDouble(); + product->yeasts[product->yeasts_row].pofpos = query.value(16).toInt() ? true:false; + product->yeasts[product->yeasts_row].zymocide = query.value(17).toInt(); + product->yeasts[product->yeasts_row].gr_hl_lo = query.value(18).toInt(); + product->yeasts[product->yeasts_row].sg_lo = query.value(19).toDouble(); + product->yeasts[product->yeasts_row].gr_hl_hi = query.value(20).toInt(); + product->yeasts[product->yeasts_row].sg_hi = query.value(21).toDouble(); + product->yeasts[product->yeasts_row].cost = query.value(22).toDouble(); + product->yeasts[product->yeasts_row].inventory = query.value(23).toDouble(); /* * Update the visible fields */ const QSignalBlocker blocker1(yamountEdit); - ynameEdit->setText(product->yeasts.at(product->yeasts_row).y_name); - ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).y_laboratory); - yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).y_product_id); - if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) { + ynameEdit->setText(product->yeasts.at(product->yeasts_row).name); + ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).laboratory); + yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).product_id); + if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) { if (oldform != YEAST_FORMS_LIQUID) - product->yeasts[product->yeasts_row].y_amount = 1; - yamountEdit->setValue(product->yeasts[product->yeasts_row].y_amount); + product->yeasts[product->yeasts_row].amount = 1; + yamountEdit->setValue(product->yeasts[product->yeasts_row].amount); yamountEdit->setDecimals(0); yamountEdit->setSingleStep(1.0); yamountLabel->setText(tr("Total packs:")); - } else if ((product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED)) { + } else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) { if (oldform == YEAST_FORMS_LIQUID) - product->yeasts[product->yeasts_row].y_amount = 0.01; - yamountEdit->setValue(product->yeasts[product->yeasts_row].y_amount * 1000.0); + product->yeasts[product->yeasts_row].amount = 0.01; + yamountEdit->setValue(product->yeasts[product->yeasts_row].amount * 1000.0); yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); yamountLabel->setText(tr("Amount in gr:")); } else { if (oldform == YEAST_FORMS_LIQUID) - product->yeasts[product->yeasts_row].y_amount = 0.01; - yamountEdit->setValue(product->yeasts[product->yeasts_row].y_amount * 1000.0); + product->yeasts[product->yeasts_row].amount = 0.01; + yamountEdit->setValue(product->yeasts[product->yeasts_row].amount * 1000.0); yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); yamountLabel->setText(tr("Amount in ml:")); } - ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_name)); - ui->yeastsTable->setItem(product->yeasts_row, 1, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_laboratory)); - ui->yeastsTable->setItem(product->yeasts_row, 2, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).y_product_id)); + ui->yeastsTable->setItem(product->yeasts_row, 0, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).name)); + ui->yeastsTable->setItem(product->yeasts_row, 1, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).laboratory)); + ui->yeastsTable->setItem(product->yeasts_row, 2, new QTableWidgetItem(product->yeasts.at(product->yeasts_row).product_id)); - item = new QTableWidgetItem(yeast_forms[product->yeasts.at(product->yeasts_row).y_form]); + item = new QTableWidgetItem(yeast_forms[product->yeasts.at(product->yeasts_row).form]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(product->yeasts_row, 3, item); - item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_min_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).min_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(product->yeasts_row, 5, item); - item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_max_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).max_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(product->yeasts_row, 6, item); - item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_tolerance, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).tolerance, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(product->yeasts_row, 7, item); - item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).y_attenuation, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(product->yeasts.at(product->yeasts_row).attenuation, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(product->yeasts_row, 8, item); - if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) - item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(product->yeasts_row).y_amount, 1, 'f', 0, '0')); - else if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY || product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED) - item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(product->yeasts_row).y_amount * 1000.0, 3, 'f', 2, '0')); + if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) + item = new QTableWidgetItem(QString("%1 pack").arg(product->yeasts.at(product->yeasts_row).amount, 1, 'f', 0, '0')); + else if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY || product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED) + item = new QTableWidgetItem(QString("%1 gr").arg(product->yeasts.at(product->yeasts_row).amount * 1000.0, 3, 'f', 2, '0')); else - item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(product->yeasts_row).y_amount * 1000.0, 3, 'f', 2, '0')); + item = new QTableWidgetItem(QString("%1 ml").arg(product->yeasts.at(product->yeasts_row).amount * 1000.0, 3, 'f', 2, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(product->yeasts_row, 9, item); @@ -886,7 +886,7 @@ this->yselectEdit->setCurrentIndex(-1); this->yselectEdit->clear(); - QString sql = "SELECT name,laboratory,product_id,inventory FROM inventory_yeasts "; + QString sql = "SELECT name,laboratory,product_id,inventory FROM inventoryeasts "; if (val) sql.append("WHERE inventory > 0 "); sql.append("ORDER BY laboratory,product_id,name"); @@ -906,7 +906,7 @@ { qDebug() << "yeast_useat_changed()" << product->yeasts_row << val; - product->yeasts[product->yeasts_row].y_use = val; + product->yeasts[product->yeasts_row].use = val; QTableWidgetItem *item = new QTableWidgetItem(yeast_use[val]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(product->yeasts_row, 5, item); @@ -964,9 +964,9 @@ instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); yamountLabel = new QLabel(dialog); yamountLabel->setObjectName(QString::fromUtf8("amountLabel")); - if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) + if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) yamountLabel->setText(tr("Total packs:")); - else if ((product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED)) + else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) yamountLabel->setText(tr("Amount in gr:")); else yamountLabel->setText(tr("Amount in ml:")); @@ -980,17 +980,17 @@ ynameEdit = new QLineEdit(dialog); ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); - ynameEdit->setText(product->yeasts.at(product->yeasts_row).y_name); + ynameEdit->setText(product->yeasts.at(product->yeasts_row).name); ynameEdit->setGeometry(QRect(160, 10, 511, 23)); ynameEdit->setReadOnly(true); ylaboratoryEdit = new QLineEdit(dialog); ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); - ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).y_laboratory); + ylaboratoryEdit->setText(product->yeasts.at(product->yeasts_row).laboratory); ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); ylaboratoryEdit->setReadOnly(true); yproduct_idEdit = new QLineEdit(dialog); yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); - yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).y_product_id); + yproduct_idEdit->setText(product->yeasts.at(product->yeasts_row).product_id); yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); yproduct_idEdit->setReadOnly(true); yselectEdit = new QComboBox(dialog); @@ -1006,18 +1006,18 @@ yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); yamountEdit->setAccelerated(true); yamountEdit->setMaximum(10000.0); - if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) { + if (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_LIQUID) { yamountEdit->setDecimals(0); yamountEdit->setSingleStep(1.0); - yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount); - } else if ((product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED)) { + yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount); + } else if ((product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).form == YEAST_FORMS_DRIED)) { yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); - yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount * 1000.0); + yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount * 1000.0); } else { yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); - yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount * 1000.0); + yamountEdit->setValue(product->yeasts.at(product->yeasts_row).amount * 1000.0); } yamountEdit->setMaximum(1000000000.0); useatEdit = new QComboBox(dialog); @@ -1027,7 +1027,7 @@ useatEdit->addItem(tr("Secondary")); useatEdit->addItem(tr("Tertiary")); useatEdit->addItem(tr("Bottle")); - useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).y_use); + useatEdit->setCurrentIndex(product->yeasts.at(product->yeasts_row).use); yeast_instock_changed(true); @@ -1065,9 +1065,9 @@ return; for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { // Only adjust dry yeast - amount = product->yeasts.at(i).y_amount * factor; - product->yeasts[i].y_amount = amount; + if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { // Only adjust dry yeast + amount = product->yeasts.at(i).amount * factor; + product->yeasts[i].amount = amount; } } }
--- a/src/EditRecipeExport.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/EditRecipeExport.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -176,17 +176,17 @@ for (int i = 0; i < recipe->yeasts.size(); i++) { xmlWriter->writeStartElement("YEAST"); xmlWriter->writeTextElement("VERSION", "1"); - xmlWriter->writeTextElement("NAME", recipe->yeasts.at(i).y_name); - xmlWriter->writeTextElement("TYPE", yeast_type[recipe->yeasts.at(i).y_type]); - xmlWriter->writeTextElement("FORM", yeast_form[recipe->yeasts.at(i).y_form]); - xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->yeasts.at(i).y_amount, 'f', 5)); - xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", (recipe->yeasts.at(i).y_form == 1) ? "TRUE":"FALSE"); - xmlWriter->writeTextElement("LABORATORY", recipe->yeasts.at(i).y_laboratory); - xmlWriter->writeTextElement("PRODUCT_ID", recipe->yeasts.at(i).y_product_id); - xmlWriter->writeTextElement("MIN_TEMPERATURE", QString::number(recipe->yeasts.at(i).y_min_temperature, 'f', 1)); - xmlWriter->writeTextElement("MAX_TEMPERATURE", QString::number(recipe->yeasts.at(i).y_max_temperature, 'f', 1)); - xmlWriter->writeTextElement("ATTENUATION", QString::number(recipe->yeasts.at(i).y_attenuation, 'f', 1)); - xmlWriter->writeTextElement("ADD_TO_SECONDARY", (recipe->yeasts.at(i).y_use == 0) ? "FALSE":"TRUE"); + xmlWriter->writeTextElement("NAME", recipe->yeasts.at(i).name); + xmlWriter->writeTextElement("TYPE", yeast_type[recipe->yeasts.at(i).type]); + xmlWriter->writeTextElement("FORM", yeast_form[recipe->yeasts.at(i).form]); + xmlWriter->writeTextElement("AMOUNT", QString::number(recipe->yeasts.at(i).amount, 'f', 5)); + xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", (recipe->yeasts.at(i).form == 1) ? "TRUE":"FALSE"); + xmlWriter->writeTextElement("LABORATORY", recipe->yeasts.at(i).laboratory); + xmlWriter->writeTextElement("PRODUCT_ID", recipe->yeasts.at(i).product_id); + xmlWriter->writeTextElement("MIN_TEMPERATURE", QString::number(recipe->yeasts.at(i).min_temperature, 'f', 1)); + xmlWriter->writeTextElement("MAX_TEMPERATURE", QString::number(recipe->yeasts.at(i).max_temperature, 'f', 1)); + xmlWriter->writeTextElement("ATTENUATION", QString::number(recipe->yeasts.at(i).attenuation, 'f', 1)); + xmlWriter->writeTextElement("ADD_TO_SECONDARY", (recipe->yeasts.at(i).use == 0) ? "FALSE":"TRUE"); xmlWriter->writeEndElement(); } xmlWriter->writeEndElement(); // YEASTS @@ -523,16 +523,16 @@ memo.append("[tabular]\n"); memo.append("[head]Gistlab en code[/head][head]Omschrijving[/head][head]Gebruik[/head][head]Vorm[/head][head]Hoeveel[/head]\n"); for (int i = 0; i < recipe->yeasts.size(); i++) { - memo.append("[row][data]" + recipe->yeasts.at(i).y_laboratory + " " + recipe->yeasts.at(i).y_product_id + "[/data]"); - memo.append("[data]" + recipe->yeasts.at(i).y_name + "[/data]"); - memo.append("[data]" + yeast_use[recipe->yeasts.at(i).y_use] + "[/data]"); - memo.append("[data]" + yeast_form[recipe->yeasts.at(i).y_form] + "[/data]"); - if (recipe->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) - memo.append("[data]" + QString::number(recipe->yeasts.at(i).y_amount, 'f', 0) + " pak[/data][/row]\n"); - else if (recipe->yeasts.at(i).y_form == YEAST_FORMS_DRY || recipe->yeasts.at(i).y_form == YEAST_FORMS_DRIED) - memo.append("[data]" + QString::number(recipe->yeasts.at(i).y_amount * 1000, 'f', 1) + " gr[/data][/row]\n"); + memo.append("[row][data]" + recipe->yeasts.at(i).laboratory + " " + recipe->yeasts.at(i).product_id + "[/data]"); + memo.append("[data]" + recipe->yeasts.at(i).name + "[/data]"); + memo.append("[data]" + yeast_use[recipe->yeasts.at(i).use] + "[/data]"); + memo.append("[data]" + yeast_form[recipe->yeasts.at(i).form] + "[/data]"); + if (recipe->yeasts.at(i).form == YEAST_FORMS_LIQUID) + memo.append("[data]" + QString::number(recipe->yeasts.at(i).amount, 'f', 0) + " pak[/data][/row]\n"); + else if (recipe->yeasts.at(i).form == YEAST_FORMS_DRY || recipe->yeasts.at(i).form == YEAST_FORMS_DRIED) + memo.append("[data]" + QString::number(recipe->yeasts.at(i).amount * 1000, 'f', 1) + " gr[/data][/row]\n"); else - memo.append("[data]" + QString::number(recipe->yeasts.at(i).y_amount * 1000, 'f', 0) + " ml[/data][/row]\n"); + memo.append("[data]" + QString::number(recipe->yeasts.at(i).amount * 1000, 'f', 0) + " ml[/data][/row]\n"); } memo.append("[/tabular]\n\n");
--- a/src/EditRecipeTab2.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/EditRecipeTab2.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -310,9 +310,9 @@ double svg = 0; if (recipe->yeasts.size() > 0) { for (i = 0; i < recipe->yeasts.size(); i++) { - if (recipe->yeasts.at(i).y_use == 0) { // Used in primary - if (recipe->yeasts.at(i).y_attenuation > svg) - svg = recipe->yeasts.at(i).y_attenuation; // Take the highest if multiple yeasts. + if (recipe->yeasts.at(i).use == 0) { // Used in primary + if (recipe->yeasts.at(i).attenuation > svg) + svg = recipe->yeasts.at(i).attenuation; // Take the highest if multiple yeasts. } // TODO: brett or others in secondary. }
--- a/src/EditRecipeTab5.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/EditRecipeTab5.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -20,11 +20,11 @@ bool EditRecipe::yeast_sort_test(const Yeasts &D1, const Yeasts &D2) { - if (D1.y_use > D2.y_use) + if (D1.use > D2.use) return false; - if (D1.y_use < D2.y_use) + if (D1.use < D2.use) return true; - return (D1.y_amount > D2.y_amount); + return (D1.amount > D2.amount); } @@ -60,40 +60,40 @@ for (int i = 0; i < recipe->yeasts.size(); i++) { - ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(recipe->yeasts.at(i).y_name)); - ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(recipe->yeasts.at(i).y_laboratory)); - ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(recipe->yeasts.at(i).y_product_id)); + ui->yeastsTable->setItem(i, 0, new QTableWidgetItem(recipe->yeasts.at(i).name)); + ui->yeastsTable->setItem(i, 1, new QTableWidgetItem(recipe->yeasts.at(i).laboratory)); + ui->yeastsTable->setItem(i, 2, new QTableWidgetItem(recipe->yeasts.at(i).product_id)); - item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(i).y_form]); + item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(i).form]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 3, item); - item = new QTableWidgetItem(yeast_use[recipe->yeasts.at(i).y_use]); + item = new QTableWidgetItem(yeast_use[recipe->yeasts.at(i).use]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 4, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_min_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).min_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 5, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_max_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).max_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 6, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_tolerance, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).tolerance, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 7, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).y_attenuation, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(i).attenuation, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 8, item); - if (recipe->yeasts.at(i).y_form == 0) - item = new QTableWidgetItem(QString("%1 pack").arg(recipe->yeasts.at(i).y_amount, 1, 'f', 0, '0')); - else if (recipe->yeasts.at(i).y_form == 1) - item = new QTableWidgetItem(QString("%1 gr").arg(recipe->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); + if (recipe->yeasts.at(i).form == 0) + item = new QTableWidgetItem(QString("%1 pack").arg(recipe->yeasts.at(i).amount, 1, 'f', 0, '0')); + else if (recipe->yeasts.at(i).form == 1) + item = new QTableWidgetItem(QString("%1 gr").arg(recipe->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); else - item = new QTableWidgetItem(QString("%1 ml").arg(recipe->yeasts.at(i).y_amount * 1000.0, 3, 'f', 2, '0')); + item = new QTableWidgetItem(QString("%1 ml").arg(recipe->yeasts.at(i).amount * 1000.0, 3, 'f', 2, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(i, 9, item); @@ -141,19 +141,19 @@ return; // No yeast in recipe. for (int i = 0; i < recipe->yeasts.size(); i++) { - if (recipe->yeasts.at(i).y_use == 0) { // Primary - if (recipe->yeasts.at(i).y_form == 1) { + if (recipe->yeasts.at(i).use == 0) { // Primary + if (recipe->yeasts.at(i).form == 1) { /* * Dry yeast, build the formule with the yeast parameters. * Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/ */ ui->yeastProcedure->setCurrentIndex(2); - ui->lo_gr_hlEdit->setValue(recipe->yeasts.at(i).y_gr_hl_lo); - ui->hi_gr_hlEdit->setValue(recipe->yeasts.at(i).y_gr_hl_hi); - ui->lo_sgEdit->setValue(recipe->yeasts.at(i).y_sg_lo); - ui->hi_sgEdit->setValue(recipe->yeasts.at(i).y_sg_hi); - double og = recipe->yeasts.at(i).y_sg_lo; - double f1 = recipe->yeasts.at(i).y_gr_hl_lo / 100.0; + ui->lo_gr_hlEdit->setValue(recipe->yeasts.at(i).gr_hl_lo); + ui->hi_gr_hlEdit->setValue(recipe->yeasts.at(i).gr_hl_hi); + ui->lo_sgEdit->setValue(recipe->yeasts.at(i).sg_lo); + ui->hi_sgEdit->setValue(recipe->yeasts.at(i).sg_hi); + double og = recipe->yeasts.at(i).sg_lo; + double f1 = recipe->yeasts.at(i).gr_hl_lo / 100.0; double f2 = round(f1 / 5 * 1000000.0) / 1000000.0; double multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008); qDebug() << " sg:" << sg << "og:" << og << "f1:" << f1 << "f2:" << f2 << "multiplier:" << multiplier; @@ -170,21 +170,21 @@ * and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ */ ui->yeastProcedure->setCurrentIndex(1); - if (recipe->yeasts.at(i).y_type == 0) { // Lager yeast + if (recipe->yeasts.at(i).type == 0) { // Lager yeast pitchrate = 1.5; if (sg > 1.060) pitchrate = 2.0; - } else if (recipe->yeasts.at(i).y_type == 6) { // Real Kveik + } else if (recipe->yeasts.at(i).type == 6) { // Real Kveik pitchrate = 0.075; } else { pitchrate = 0.75; if (sg > 1.060) pitchrate = 1.0; } - if (recipe->yeasts.at(i).y_form == 0) - initcells = (recipe->yeasts.at(i).y_cells / 1000000000) * recipe->yeasts.at(i).y_amount * 0.97; // 97% viability assumed. + if (recipe->yeasts.at(i).form == 0) + initcells = (recipe->yeasts.at(i).cells / 1000000000) * recipe->yeasts.at(i).amount * 0.97; // 97% viability assumed. else - initcells = (recipe->yeasts.at(i).y_cells / 1000000) * recipe->yeasts.at(i).y_amount * 0.97; + initcells = (recipe->yeasts.at(i).cells / 1000000) * recipe->yeasts.at(i).amount * 0.97; double needed = round(pitchrate * volume * plato * 10.0) / 10.0; double starter = 0; @@ -213,36 +213,36 @@ qDebug() << "Add yeast row"; for (int i = 0; i < recipe->yeasts.size(); i++) { - if (recipe->yeasts.at(i).y_amount == 0) + if (recipe->yeasts.at(i).amount == 0) return; // Add only one at a time. } - newy.y_name = "Select one"; - newy.y_laboratory = ""; - newy.y_product_id = ""; - newy.y_amount = 0; - newy.y_type = 0; - newy.y_form = 0; - newy.y_min_temperature = 0; - newy.y_max_temperature = 0; - newy.y_flocculation = 0; - newy.y_attenuation = 0; - newy.y_cells = 0; - newy.y_tolerance = 0; - newy.y_inventory = 0; - newy.y_use = 0; - newy.y_sta1 = false; - newy.y_bacteria = false; - newy.y_harvest_top = false; - newy.y_harvest_time = 0; - newy.y_pitch_temperature = 0; - newy.y_pofpos = false; - newy.y_zymocide = 0; - newy.y_gr_hl_lo = 0; - newy.y_sg_lo = 0; - newy.y_gr_hl_hi = 0; - newy.y_sg_hi = 0; - newy.y_cost = 0; + newy.name = "Select one"; + newy.laboratory = ""; + newy.product_id = ""; + newy.amount = 0; + newy.type = 0; + newy.form = 0; + newy.min_temperature = 0; + newy.max_temperature = 0; + newy.flocculation = 0; + newy.attenuation = 0; + newy.cells = 0; + newy.tolerance = 0; + newy.inventory = 0; + newy.use = 0; + newy.sta1 = false; + newy.bacteria = false; + newy.harvest_top = false; + newy.harvest_time = 0; + newy.pitch_temperature = 0; + newy.pofpos = false; + newy.zymocide = 0; + newy.gr_hl_lo = 0; + newy.sg_lo = 0; + newy.gr_hl_hi = 0; + newy.sg_hi = 0; + newy.cost = 0; recipe->yeasts.append(newy); emit refreshAll(); @@ -258,7 +258,7 @@ int row = pb->objectName().toInt(); qDebug() << "Delete yeast row" << row << recipe->yeasts.size(); - int rc = QMessageBox::warning(this, tr("Delete yeast"), tr("Delete %1").arg(recipe->yeasts.at(row).y_name), + int rc = QMessageBox::warning(this, tr("Delete yeast"), tr("Delete %1").arg(recipe->yeasts.at(row).name), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (rc == QMessageBox::No) return; @@ -275,14 +275,14 @@ qDebug() << "yeast_amount_changed()" << recipe->yeasts_row << val; - if (recipe->yeasts.at(recipe->yeasts_row).y_form == 0) { - recipe->yeasts[recipe->yeasts_row].y_amount = val; + if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { + recipe->yeasts[recipe->yeasts_row].amount = val; item = new QTableWidgetItem(QString("%1 pack").arg(val, 1, 'f', 0, '0')); - } else if (recipe->yeasts.at(recipe->yeasts_row).y_form == 1) { - recipe->yeasts[recipe->yeasts_row].y_amount = val / 1000.0; + } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { + recipe->yeasts[recipe->yeasts_row].amount = val / 1000.0; item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0')); } else { - recipe->yeasts[recipe->yeasts_row].y_amount = val / 1000.0; + recipe->yeasts[recipe->yeasts_row].amount = val / 1000.0; item = new QTableWidgetItem(QString("%1 ml").arg(val, 3, 'f', 2, '0')); } item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -310,7 +310,7 @@ */ QString sql = "SELECT name,laboratory,product_id,type,form,min_temperature,max_temperature,flocculation,attenuation," "cells,tolerance,sta1,bacteria,harvest_top,harvest_time,pitch_temperature,pofpos,zymocide," - "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost FROM inventory_yeasts "; + "gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,cost FROM inventoryeasts "; if (instock) sql.append("WHERE inventory > 0 "); sql.append("ORDER BY laboratory,product_id,name"); @@ -325,41 +325,41 @@ /* * Replace the yeast record contents */ - recipe->yeasts[recipe->yeasts_row].y_name = query.value(0).toString(); - recipe->yeasts[recipe->yeasts_row].y_laboratory = query.value(1).toString(); - recipe->yeasts[recipe->yeasts_row].y_product_id = query.value(2).toString(); - recipe->yeasts[recipe->yeasts_row].y_type = query.value(3).toInt(); - recipe->yeasts[recipe->yeasts_row].y_form = query.value(4).toInt(); - recipe->yeasts[recipe->yeasts_row].y_min_temperature = query.value(5).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_max_temperature = query.value(6).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_flocculation = query.value(7).toInt(); - recipe->yeasts[recipe->yeasts_row].y_attenuation = query.value(8).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_cells = query.value(9).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_tolerance = query.value(10).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_sta1 = query.value(11).toInt() ? true:false; - recipe->yeasts[recipe->yeasts_row].y_bacteria = query.value(12).toInt() ? true:false; - recipe->yeasts[recipe->yeasts_row].y_harvest_top = query.value(13).toInt() ? true:false; - recipe->yeasts[recipe->yeasts_row].y_harvest_time = query.value(14).toInt(); - recipe->yeasts[recipe->yeasts_row].y_pitch_temperature = query.value(15).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_pofpos = query.value(16).toInt() ? true:false; - recipe->yeasts[recipe->yeasts_row].y_zymocide = query.value(17).toInt(); - recipe->yeasts[recipe->yeasts_row].y_gr_hl_lo = query.value(18).toInt(); - recipe->yeasts[recipe->yeasts_row].y_sg_lo = query.value(19).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_gr_hl_hi = query.value(20).toInt(); - recipe->yeasts[recipe->yeasts_row].y_sg_hi = query.value(21).toDouble(); - recipe->yeasts[recipe->yeasts_row].y_cost = query.value(22).toDouble(); + recipe->yeasts[recipe->yeasts_row].name = query.value(0).toString(); + recipe->yeasts[recipe->yeasts_row].laboratory = query.value(1).toString(); + recipe->yeasts[recipe->yeasts_row].product_id = query.value(2).toString(); + recipe->yeasts[recipe->yeasts_row].type = query.value(3).toInt(); + recipe->yeasts[recipe->yeasts_row].form = query.value(4).toInt(); + recipe->yeasts[recipe->yeasts_row].min_temperature = query.value(5).toDouble(); + recipe->yeasts[recipe->yeasts_row].max_temperature = query.value(6).toDouble(); + recipe->yeasts[recipe->yeasts_row].flocculation = query.value(7).toInt(); + recipe->yeasts[recipe->yeasts_row].attenuation = query.value(8).toDouble(); + recipe->yeasts[recipe->yeasts_row].cells = query.value(9).toDouble(); + recipe->yeasts[recipe->yeasts_row].tolerance = query.value(10).toDouble(); + recipe->yeasts[recipe->yeasts_row].sta1 = query.value(11).toInt() ? true:false; + recipe->yeasts[recipe->yeasts_row].bacteria = query.value(12).toInt() ? true:false; + recipe->yeasts[recipe->yeasts_row].harvest_top = query.value(13).toInt() ? true:false; + recipe->yeasts[recipe->yeasts_row].harvest_time = query.value(14).toInt(); + recipe->yeasts[recipe->yeasts_row].pitch_temperature = query.value(15).toDouble(); + recipe->yeasts[recipe->yeasts_row].pofpos = query.value(16).toInt() ? true:false; + recipe->yeasts[recipe->yeasts_row].zymocide = query.value(17).toInt(); + recipe->yeasts[recipe->yeasts_row].gr_hl_lo = query.value(18).toInt(); + recipe->yeasts[recipe->yeasts_row].sg_lo = query.value(19).toDouble(); + recipe->yeasts[recipe->yeasts_row].gr_hl_hi = query.value(20).toInt(); + recipe->yeasts[recipe->yeasts_row].sg_hi = query.value(21).toDouble(); + recipe->yeasts[recipe->yeasts_row].cost = query.value(22).toDouble(); /* * Update the visible fields */ - ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_name); - ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_laboratory); - yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_product_id); - if (recipe->yeasts.at(recipe->yeasts_row).y_form == 0) { + ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).name); + ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).laboratory); + yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).product_id); + if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { yamountEdit->setDecimals(0); yamountEdit->setSingleStep(1.0); yamountLabel->setText(tr("Total packs:")); - } else if (recipe->yeasts.at(recipe->yeasts_row).y_form == 1) { + } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); yamountLabel->setText(tr("Amount in gr:")); @@ -369,27 +369,27 @@ yamountLabel->setText(tr("Amount in ml:")); } - ui->yeastsTable->setItem(recipe->yeasts_row, 0, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).y_name)); - ui->yeastsTable->setItem(recipe->yeasts_row, 1, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).y_laboratory)); - ui->yeastsTable->setItem(recipe->yeasts_row, 2, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).y_product_id)); + ui->yeastsTable->setItem(recipe->yeasts_row, 0, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).name)); + ui->yeastsTable->setItem(recipe->yeasts_row, 1, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).laboratory)); + ui->yeastsTable->setItem(recipe->yeasts_row, 2, new QTableWidgetItem(recipe->yeasts.at(recipe->yeasts_row).product_id)); - item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(recipe->yeasts_row).y_form]); + item = new QTableWidgetItem(yeast_forms[recipe->yeasts.at(recipe->yeasts_row).form]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(recipe->yeasts_row, 3, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_min_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).min_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(recipe->yeasts_row, 5, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_max_temperature, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).max_temperature, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(recipe->yeasts_row, 6, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_tolerance, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).tolerance, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(recipe->yeasts_row, 7, item); - item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).y_attenuation, 2, 'f', 1, '0')); + item = new QTableWidgetItem(QString("%1").arg(recipe->yeasts.at(recipe->yeasts_row).attenuation, 2, 'f', 1, '0')); item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); ui->yeastsTable->setItem(recipe->yeasts_row, 8, item); @@ -406,7 +406,7 @@ this->yselectEdit->setCurrentIndex(-1); this->yselectEdit->clear(); - QString sql = "SELECT name,laboratory,product_id,inventory FROM inventory_yeasts "; + QString sql = "SELECT name,laboratory,product_id,inventory FROM inventoryeasts "; if (val) sql.append("WHERE inventory > 0 "); sql.append("ORDER BY laboratory,product_id,name"); @@ -426,7 +426,7 @@ { qDebug() << "yeast_useat_changed()" << recipe->yeasts_row << val; - recipe->yeasts[recipe->yeasts_row].y_use = val; + recipe->yeasts[recipe->yeasts_row].use = val; QTableWidgetItem *item = new QTableWidgetItem(yeast_use[val]); item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); ui->yeastsTable->setItem(recipe->yeasts_row, 5, item); @@ -484,9 +484,9 @@ instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); yamountLabel = new QLabel(dialog); yamountLabel->setObjectName(QString::fromUtf8("amountLabel")); - if (recipe->yeasts.at(recipe->yeasts_row).y_form == 0) + if (recipe->yeasts.at(recipe->yeasts_row).form == 0) yamountLabel->setText(tr("Total packs:")); - else if (recipe->yeasts.at(recipe->yeasts_row).y_form == 1) + else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) yamountLabel->setText(tr("Amount in gr:")); else yamountLabel->setText(tr("Amount in ml:")); @@ -500,17 +500,17 @@ ynameEdit = new QLineEdit(dialog); ynameEdit->setObjectName(QString::fromUtf8("ynameEdit")); - ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_name); + ynameEdit->setText(recipe->yeasts.at(recipe->yeasts_row).name); ynameEdit->setGeometry(QRect(160, 10, 511, 23)); ynameEdit->setReadOnly(true); ylaboratoryEdit = new QLineEdit(dialog); ylaboratoryEdit->setObjectName(QString::fromUtf8("ylaboratoryEdit")); - ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_laboratory); + ylaboratoryEdit->setText(recipe->yeasts.at(recipe->yeasts_row).laboratory); ylaboratoryEdit->setGeometry(QRect(160, 40, 511, 23)); ylaboratoryEdit->setReadOnly(true); yproduct_idEdit = new QLineEdit(dialog); yproduct_idEdit->setObjectName(QString::fromUtf8("yproduct_idEdit")); - yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).y_product_id); + yproduct_idEdit->setText(recipe->yeasts.at(recipe->yeasts_row).product_id); yproduct_idEdit->setGeometry(QRect(160, 70, 511, 23)); yproduct_idEdit->setReadOnly(true); yselectEdit = new QComboBox(dialog); @@ -525,18 +525,18 @@ yamountEdit->setGeometry(QRect(160, 130, 121, 24)); yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); yamountEdit->setAccelerated(true); - if (recipe->yeasts.at(recipe->yeasts_row).y_form == 0) { + if (recipe->yeasts.at(recipe->yeasts_row).form == 0) { yamountEdit->setDecimals(0); yamountEdit->setSingleStep(1.0); - yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).y_amount); - } else if (recipe->yeasts.at(recipe->yeasts_row).y_form == 1) { + yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount); + } else if (recipe->yeasts.at(recipe->yeasts_row).form == 1) { yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); - yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).y_amount * 1000.0); + yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount * 1000.0); } else { yamountEdit->setDecimals(1); yamountEdit->setSingleStep(0.5); - yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).y_amount * 1000.0); + yamountEdit->setValue(recipe->yeasts.at(recipe->yeasts_row).amount * 1000.0); } yamountEdit->setMaximum(1000000000.0); useatEdit = new QComboBox(dialog); @@ -546,7 +546,7 @@ useatEdit->addItem(tr("Secondary")); useatEdit->addItem(tr("Tertiary")); useatEdit->addItem(tr("Bottle")); - useatEdit->setCurrentIndex(recipe->yeasts.at(recipe->yeasts_row).y_use); + useatEdit->setCurrentIndex(recipe->yeasts.at(recipe->yeasts_row).use); yeast_instock_changed(true); @@ -584,9 +584,9 @@ return; for (int i = 0; i < recipe->yeasts.size(); i++) { - if (recipe->yeasts.at(i).y_form == 1) { // Only adjust dry yeast - amount = recipe->yeasts.at(i).y_amount * factor; - recipe->yeasts[i].y_amount = amount; + if (recipe->yeasts.at(i).form == 1) { // Only adjust dry yeast + amount = recipe->yeasts.at(i).amount * factor; + recipe->yeasts[i].amount = amount; } } }
--- a/src/PrinterDialog.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/PrinterDialog.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -480,23 +480,23 @@ painter.setFont(QFont("Helvetica", 9, QFont::Normal)); double cost_yeasts = 0; for (int i = 0; i < recipe->yeasts.size(); i++) { - double cost = recipe->yeasts.at(i).y_amount * recipe->yeasts.at(i).y_cost; + double cost = recipe->yeasts.at(i).amount * recipe->yeasts.at(i).cost; cost_yeasts += cost; - if (recipe->yeasts.at(i).y_form == 0) - amount = QString("%1 pack").arg(recipe->yeasts.at(i).y_amount, 1, 'f', 0); - else if (recipe->yeasts.at(i).y_form == 1 || recipe->yeasts.at(i).y_form == 6) - amount = QString("%1 gr").arg(recipe->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); + if (recipe->yeasts.at(i).form == 0) + amount = QString("%1 pack").arg(recipe->yeasts.at(i).amount, 1, 'f', 0); + else if (recipe->yeasts.at(i).form == 1 || recipe->yeasts.at(i).form == 6) + amount = QString("%1 gr").arg(recipe->yeasts.at(i).amount * 1000.0, 1, 'f', 1); else - amount = QString("%1 ml").arg(recipe->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); + amount = QString("%1 ml").arg(recipe->yeasts.at(i).amount * 1000.0, 1, 'f', 1); painter.fillRect( 20, y, 715, 20, y_line); - painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->yeasts.at(i).y_laboratory + " " + - recipe->yeasts.at(i).y_product_id + " (" + - recipe->yeasts.at(i).y_name + ")"); - painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->yeasts.at(i).y_attenuation, 1, 'f', 1)); - painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, yeast_forms[recipe->yeasts.at(i).y_form]); - painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, yeast_use[recipe->yeasts.at(i).y_use]); + painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, recipe->yeasts.at(i).laboratory + " " + + recipe->yeasts.at(i).product_id + " (" + + recipe->yeasts.at(i).name + ")"); + painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(recipe->yeasts.at(i).attenuation, 1, 'f', 1)); + painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, yeast_forms[recipe->yeasts.at(i).form]); + painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, yeast_use[recipe->yeasts.at(i).use]); painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); y += 20; @@ -880,23 +880,23 @@ painter.setFont(QFont("Helvetica", 9, QFont::Normal)); double cost_yeasts = 0; for (int i = 0; i < product->yeasts.size(); i++) { - double cost = product->yeasts.at(i).y_amount * product->yeasts.at(i).y_cost; + double cost = product->yeasts.at(i).amount * product->yeasts.at(i).cost; cost_yeasts += cost; - if (product->yeasts.at(i).y_form == 0) - amount = QString("%1 pack").arg(product->yeasts.at(i).y_amount, 1, 'f', 0); - else if (product->yeasts.at(i).y_form == 1 || product->yeasts.at(i).y_form == 6) - amount = QString("%1 gr").arg(product->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); + if (product->yeasts.at(i).form == 0) + amount = QString("%1 pack").arg(product->yeasts.at(i).amount, 1, 'f', 0); + else if (product->yeasts.at(i).form == 1 || product->yeasts.at(i).form == 6) + amount = QString("%1 gr").arg(product->yeasts.at(i).amount * 1000.0, 1, 'f', 1); else - amount = QString("%1 ml").arg(product->yeasts.at(i).y_amount * 1000.0, 1, 'f', 1); + amount = QString("%1 ml").arg(product->yeasts.at(i).amount * 1000.0, 1, 'f', 1); painter.fillRect( 20, y, 715, 20, y_line); - painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->yeasts.at(i).y_laboratory + " " + - product->yeasts.at(i).y_product_id + " (" + - product->yeasts.at(i).y_name + ")"); - painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->yeasts.at(i).y_attenuation, 1, 'f', 1)); - painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, yeast_forms[product->yeasts.at(i).y_form]); - painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, yeast_use[product->yeasts.at(i).y_use]); + painter.drawText( 20, y+4, 260, 20, Qt::AlignLeft, product->yeasts.at(i).laboratory + " " + + product->yeasts.at(i).product_id + " (" + + product->yeasts.at(i).name + ")"); + painter.drawText(360, y+4, 70, 20, Qt::AlignRight, QString("%1%").arg(product->yeasts.at(i).attenuation, 1, 'f', 1)); + painter.drawText(435, y+4, 80, 20, Qt::AlignLeft, yeast_forms[product->yeasts.at(i).form]); + painter.drawText(520, y+4, 80, 20, Qt::AlignLeft, yeast_use[product->yeasts.at(i).use]); painter.drawText(605, y+4, 60, 20, Qt::AlignRight, amount); painter.drawText(670, y+4, 60, 20, Qt::AlignRight, QString("%1 €").arg(cost, 1, 'f', 3)); y += 20; @@ -1843,9 +1843,9 @@ double climate = product->brew_cooling_to; lines = 3; for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { + if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { lines++; - if (product->yeasts.at(i).y_type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).y_pitch_temperature > 0)) + if (product->yeasts.at(i).type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).pitch_temperature > 0)) lines++; } } @@ -1863,24 +1863,24 @@ double dry = 0; checkHeader(&painter, &y, tr("Yeast pitching and fermentation")); for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { - switch (product->yeasts.at(i).y_form) { - case YEAST_FORMS_LIQUID: checkLine(&painter, &y, QString(tr("%1 pack %2, `%3` yeast")).arg(product->yeasts.at(i).y_amount) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + if (product->yeasts.at(i).use == YEAST_USE_PRIMARY) { + switch (product->yeasts.at(i).form) { + case YEAST_FORMS_LIQUID: checkLine(&painter, &y, QString(tr("%1 pack %2, `%3` yeast")).arg(product->yeasts.at(i).amount) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); break; - case YEAST_FORMS_DRY: dry += product->yeasts.at(i).y_amount * 1000 * factor; + case YEAST_FORMS_DRY: dry += product->yeasts.at(i).amount * 1000 * factor; case YEAST_FORMS_DRIED: checkLine(&painter, &y, QString(tr("%1 gram %2, `%3` yeast")) - .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); break; default: checkLine(&painter, &y, QString(tr("%1 ml %2, `%3` yeast")) - .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 0) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 0) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); break; } - if (product->yeasts.at(i).y_type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).y_pitch_temperature > 0)) { - checkLine(&painter, &y, QString(tr("Pitch yeast at %1°C")).arg(product->yeasts.at(i).y_pitch_temperature, 1, 'f', 1)); - climate = product->yeasts.at(i).y_pitch_temperature; + if (product->yeasts.at(i).type == YEAST_TYPES_KVEIK && (product->yeasts.at(i).pitch_temperature > 0)) { + checkLine(&painter, &y, QString(tr("Pitch yeast at %1°C")).arg(product->yeasts.at(i).pitch_temperature, 1, 'f', 1)); + climate = product->yeasts.at(i).pitch_temperature; } } } @@ -1936,9 +1936,9 @@ /* During secondary fermentation, yeast */ lines = 0; for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_SECONDARY) + if (product->yeasts.at(i).use == YEAST_USE_SECONDARY) lines++; - if (product->yeasts.at(i).y_harvest_time > 0) + if (product->yeasts.at(i).harvest_time > 0) lines++; } if (lines) { @@ -1951,22 +1951,22 @@ } checkHeader(&painter, &y, tr("Secondary fermentation")); for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_SECONDARY) { - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { + if (product->yeasts.at(i).use == YEAST_USE_SECONDARY) { + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) { checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)")) - .arg(product->yeasts.at(i).y_amount).arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); - } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { - checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount).arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); + } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { + checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); } else { checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` yeast (with starter if needed)")) - .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); } } - if (product->yeasts.at(i).y_harvest_time > 0) { - checkLine(&painter, &y, QString(tr("After %1 hours harvest yeast from the %2")).arg(product->yeasts.at(i).y_harvest_time) - .arg((product->yeasts.at(i).y_harvest_top > 0) ? "top":"bottom")); + if (product->yeasts.at(i).harvest_time > 0) { + checkLine(&painter, &y, QString(tr("After %1 hours harvest yeast from the %2")).arg(product->yeasts.at(i).harvest_time) + .arg((product->yeasts.at(i).harvest_top > 0) ? "top":"bottom")); } } } @@ -1985,7 +1985,7 @@ if (product->miscs.at(i).use_use == MISC_USES_SECONDARY) lines++; for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_TERTIARY) + if (product->yeasts.at(i).use == YEAST_USE_TERTIARY) lines++; } if (lines) { @@ -2009,17 +2009,17 @@ } } for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_TERTIARY) { - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { + if (product->yeasts.at(i).use == YEAST_USE_TERTIARY) { + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) { checkLine(&painter, &y, QString(tr("Add %1 pack %2, `%3` yeast (with starter if needed)")) - .arg(product->yeasts.at(i).y_amount).arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); - } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { - checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount).arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); + } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { + checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3`")).arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); } else { checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` yeast (with starter if needed)")) - .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); } } } @@ -2043,7 +2043,7 @@ if (product->miscs.at(i).use_use == MISC_USES_BOTTLING) lines++; for (int i = 0; i < product->yeasts.size(); i++) - if (product->yeasts.at(i).y_use == YEAST_USE_BOTTLE) + if (product->yeasts.at(i).use == YEAST_USE_BOTTLE) lines++; if (lines) { if ((y + 20 + (lines * 20)) > painter.device()->height()) { @@ -2065,18 +2065,18 @@ .arg(product->fermentables.at(i).name).arg(product->keg_priming_water * factor, 1, 'f', 3)); } for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == YEAST_USE_BOTTLE) { - if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { + if (product->yeasts.at(i).use == YEAST_USE_BOTTLE) { + if (product->yeasts.at(i).form == YEAST_FORMS_LIQUID) { checkLine(&painter, &y, QString(tr("Add %1, `%2` as bottle yeast")) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); - } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); + } else if (product->yeasts.at(i).form == YEAST_FORMS_DRY) { checkLine(&painter, &y, QString(tr("Add %1 gram %2, `%3` as bottle yeast")) - .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); } else { checkLine(&painter, &y, QString(tr("Add %1 ml %2, `%3` as bottle yeast")) - .arg(product->yeasts.at(i).y_amount * 1000 * factor, 1, 'f', 1) - .arg(product->yeasts.at(i).y_product_id).arg(product->yeasts.at(i).y_name)); + .arg(product->yeasts.at(i).amount * 1000 * factor, 1, 'f', 1) + .arg(product->yeasts.at(i).product_id).arg(product->yeasts.at(i).name)); } } }
--- a/src/database/db_product.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/database/db_product.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -427,69 +427,69 @@ QJsonObject obj = yeasts.array().at(i).toObject(); Yeasts y; /* First some defaults for newer fields. */ - y.y_tolerance = y.y_harvest_time = y.y_pitch_temperature = y.y_zymocide = 0; - y.y_avail = y.y_sta1 = y.y_bacteria = y.y_harvest_top = y.y_pofpos = false; - y.y_gr_hl_lo = 50; - y.y_sg_lo = 1.04; - y.y_gr_hl_hi = 80; - y.y_sg_hi = 1.08; + y.tolerance = y.harvest_time = y.pitch_temperature = y.zymocide = 0; + y.avail = y.sta1 = y.bacteria = y.harvest_top = y.pofpos = false; + y.gr_hl_lo = 50; + y.sg_lo = 1.04; + y.gr_hl_hi = 80; + y.sg_hi = 1.08; /* Now get what we have got */ - y.y_name = obj["y_name"].toString(); - y.y_laboratory = obj["y_laboratory"].toString(); - y.y_product_id = obj["y_product_id"].toString(); - y.y_amount = obj["y_amount"].toDouble(); - y.y_type = obj["y_type"].toInt(); - y.y_form = obj["y_form"].toInt(); - y.y_min_temperature = obj["y_min_temperature"].toDouble(); - y.y_max_temperature = obj["y_max_temperature"].toDouble(); - y.y_flocculation = obj["y_flocculation"].toInt(); - y.y_attenuation = obj["y_attenuation"].toDouble(); - y.y_cells = obj["y_cells"].toDouble(); - y.y_tolerance = obj["y_tolerance"].toDouble(); - y.y_inventory = obj["y_inventory"].toDouble(); - y.y_use = obj["y_use"].toInt(); - y.y_sta1 = obj["y_sta1"].toInt() ? true:false; - y.y_bacteria = obj["y_bacteria"].toInt() ? true:false; - y.y_harvest_top = obj["y_harvest_top"].toInt() ? true:false; - y.y_harvest_time = obj["y_harvest_time"].toInt(); - y.y_pitch_temperature = obj["y_pitch_temperature"].toDouble(); - y.y_pofpos = obj["y_pofpos"].toInt() ? true:false; - y.y_zymocide = obj["y_zymocide"].toInt(); - y.y_gr_hl_lo = obj["y_gr_hl_lo"].toInt(); - y.y_sg_lo = obj["y_sg_lo"].toDouble(); - y.y_gr_hl_hi = obj["y_gr_hl_hi"].toInt(); - y.y_sg_hi = obj["y_sg_hi"].toDouble(); - y.y_cost = obj["y_cost"].toDouble(); + y.name = obj["y_name"].toString(); + y.laboratory = obj["y_laboratory"].toString(); + y.product_id = obj["y_product_id"].toString(); + y.amount = obj["y_amount"].toDouble(); + y.type = obj["y_type"].toInt(); + y.form = obj["y_form"].toInt(); + y.min_temperature = obj["y_min_temperature"].toDouble(); + y.max_temperature = obj["y_max_temperature"].toDouble(); + y.flocculation = obj["y_flocculation"].toInt(); + y.attenuation = obj["y_attenuation"].toDouble(); + y.cells = obj["y_cells"].toDouble(); + y.tolerance = obj["y_tolerance"].toDouble(); + y.inventory = obj["y_inventory"].toDouble(); + y.use = obj["y_use"].toInt(); + y.sta1 = obj["y_sta1"].toInt() ? true:false; + y.bacteria = obj["y_bacteria"].toInt() ? true:false; + y.harvest_top = obj["y_harvest_top"].toInt() ? true:false; + y.harvest_time = obj["y_harvest_time"].toInt(); + y.pitch_temperature = obj["y_pitch_temperature"].toDouble(); + y.pofpos = obj["y_pofpos"].toInt() ? true:false; + y.zymocide = obj["y_zymocide"].toInt(); + y.gr_hl_lo = obj["y_gr_hl_lo"].toInt(); + y.sg_lo = obj["y_sg_lo"].toDouble(); + y.gr_hl_hi = obj["y_gr_hl_hi"].toInt(); + y.sg_hi = obj["y_sg_hi"].toDouble(); + y.cost = obj["y_cost"].toDouble(); /* * Possible data upgrade needed. */ yquery.prepare("SELECT tolerance,cells,sta1,bacteria,harvest_top,harvest_time,pitch_temperature," "pofpos,zymocide,gr_hl_lo,sg_lo,gr_hl_hi,sg_hi,inventory " "FROM inventory_yeasts WHERE name=:name AND laboratory=:laboratory AND product_id=:product_id"); - yquery.bindValue(":name", y.y_name); - yquery.bindValue(":laboratory", y.y_laboratory); - yquery.bindValue(":product_id", y.y_product_id); + yquery.bindValue(":name", y.name); + yquery.bindValue(":laboratory", y.laboratory); + yquery.bindValue(":product_id", y.product_id); yquery.exec(); if (yquery.first()) { - if (y.y_tolerance == 0 || y.y_cells == 0) { - y.y_tolerance = yquery.value(0).toDouble(); - y.y_cells = yquery.value(1).toDouble(); + if (y.tolerance == 0 || y.cells == 0) { + y.tolerance = yquery.value(0).toDouble(); + y.cells = yquery.value(1).toDouble(); } - y.y_sta1 = yquery.value(2).toInt() ? true:false; - y.y_bacteria = yquery.value(3).toInt() ? true:false; - y.y_harvest_top = yquery.value(4).toInt() ? true:false; - y.y_harvest_time = yquery.value(5).toInt(); - y.y_pitch_temperature = yquery.value(6).toDouble(); - y.y_pofpos = yquery.value(7).toInt() ? true:false; - y.y_zymocide = yquery.value(8).toInt(); - y.y_gr_hl_lo = yquery.value(9).toInt(); - y.y_sg_lo = yquery.value(10).toDouble(); - y.y_gr_hl_hi = yquery.value(11).toInt(); - y.y_sg_hi = yquery.value(12).toDouble(); - y.y_inventory = yquery.value(13).toDouble(); - y.y_avail = true; + y.sta1 = yquery.value(2).toInt() ? true:false; + y.bacteria = yquery.value(3).toInt() ? true:false; + y.harvest_top = yquery.value(4).toInt() ? true:false; + y.harvest_time = yquery.value(5).toInt(); + y.pitch_temperature = yquery.value(6).toDouble(); + y.pofpos = yquery.value(7).toInt() ? true:false; + y.zymocide = yquery.value(8).toInt(); + y.gr_hl_lo = yquery.value(9).toInt(); + y.sg_lo = yquery.value(10).toDouble(); + y.gr_hl_hi = yquery.value(11).toInt(); + y.sg_hi = yquery.value(12).toDouble(); + y.inventory = yquery.value(13).toDouble(); + y.avail = true; } else { - qDebug() << y.y_name << y.y_product_id << "not found for upgrade"; + qDebug() << y.name << y.product_id << "not found for upgrade"; } prod->yeasts.append(y); } @@ -926,32 +926,32 @@ QJsonArray array; for (int i = 0; i < prod->yeasts.size(); i++) { QJsonObject obj; - obj.insert("y_name", prod->yeasts.at(i).y_name); - obj.insert("y_laboratory", prod->yeasts.at(i).y_laboratory); - obj.insert("y_product_id", prod->yeasts.at(i).y_product_id); - obj.insert("y_amount", round(prod->yeasts.at(i).y_amount * 100000) / 100000); - obj.insert("y_type", prod->yeasts.at(i).y_type); - obj.insert("y_form", prod->yeasts.at(i).y_form); - obj.insert("y_min_temperature", round(prod->yeasts.at(i).y_min_temperature * 10) / 10); - obj.insert("y_max_temperature", round(prod->yeasts.at(i).y_max_temperature * 10) / 10); - obj.insert("y_flocculation", prod->yeasts.at(i).y_flocculation); - obj.insert("y_attenuation", round(prod->yeasts.at(i).y_attenuation * 10) / 10); - obj.insert("y_cells", prod->yeasts.at(i).y_cells); - obj.insert("y_tolerance", round(prod->yeasts.at(i).y_tolerance * 10) / 10); - obj.insert("y_inventory", round(prod->yeasts.at(i).y_inventory * 10000) / 10000); - obj.insert("y_use", prod->yeasts.at(i).y_use); - obj.insert("y_sta1", prod->yeasts.at(i).y_sta1 ? 1:0); - obj.insert("y_bacteria", prod->yeasts.at(i).y_bacteria ? 1:0); - obj.insert("y_harvest_top", prod->yeasts.at(i).y_harvest_top ? 1:0); - obj.insert("y_harvest_time", prod->yeasts.at(i).y_harvest_time); - obj.insert("y_pitch_temperature", round(prod->yeasts.at(i).y_pitch_temperature * 10) / 10); - obj.insert("y_pofpos", prod->yeasts.at(i).y_pofpos ? 1:0); - obj.insert("y_zymocide", prod->yeasts.at(i).y_zymocide); - obj.insert("y_gr_hl_lo", prod->yeasts.at(i).y_gr_hl_lo); - obj.insert("y_sg_lo", round(prod->yeasts.at(i).y_sg_lo * 1000) / 1000); - obj.insert("y_gr_hl_hi", prod->yeasts.at(i).y_gr_hl_hi); - obj.insert("y_sg_hi", round(prod->yeasts.at(i).y_sg_hi * 1000) / 1000); - obj.insert("y_cost", round(prod->yeasts.at(i).y_cost * 1000) / 1000); + obj.insert("y_name", prod->yeasts.at(i).name); + obj.insert("y_laboratory", prod->yeasts.at(i).laboratory); + obj.insert("y_product_id", prod->yeasts.at(i).product_id); + obj.insert("y_amount", round(prod->yeasts.at(i).amount * 100000) / 100000); + obj.insert("y_type", prod->yeasts.at(i).type); + obj.insert("y_form", prod->yeasts.at(i).form); + obj.insert("y_min_temperature", round(prod->yeasts.at(i).min_temperature * 10) / 10); + obj.insert("y_max_temperature", round(prod->yeasts.at(i).max_temperature * 10) / 10); + obj.insert("y_flocculation", prod->yeasts.at(i).flocculation); + obj.insert("y_attenuation", round(prod->yeasts.at(i).attenuation * 10) / 10); + obj.insert("y_cells", prod->yeasts.at(i).cells); + obj.insert("y_tolerance", round(prod->yeasts.at(i).tolerance * 10) / 10); + obj.insert("y_inventory", round(prod->yeasts.at(i).inventory * 10000) / 10000); + obj.insert("y_use", prod->yeasts.at(i).use); + obj.insert("y_sta1", prod->yeasts.at(i).sta1 ? 1:0); + obj.insert("y_bacteria", prod->yeasts.at(i).bacteria ? 1:0); + obj.insert("y_harvest_top", prod->yeasts.at(i).harvest_top ? 1:0); + obj.insert("y_harvest_time", prod->yeasts.at(i).harvest_time); + obj.insert("y_pitch_temperature", round(prod->yeasts.at(i).pitch_temperature * 10) / 10); + obj.insert("y_pofpos", prod->yeasts.at(i).pofpos ? 1:0); + obj.insert("y_zymocide", prod->yeasts.at(i).zymocide); + obj.insert("y_gr_hl_lo", prod->yeasts.at(i).gr_hl_lo); + obj.insert("y_sg_lo", round(prod->yeasts.at(i).sg_lo * 1000) / 1000); + obj.insert("y_gr_hl_hi", prod->yeasts.at(i).gr_hl_hi); + obj.insert("y_sg_hi", round(prod->yeasts.at(i).sg_hi * 1000) / 1000); + obj.insert("y_cost", round(prod->yeasts.at(i).cost * 1000) / 1000); // qDebug() << "yeasts_Json" << i << obj; array.append(obj); /* Append this object */ }
--- a/src/database/db_recipe.cpp Mon Jun 13 16:47:52 2022 +0200 +++ b/src/database/db_recipe.cpp Mon Jun 13 17:34:51 2022 +0200 @@ -251,67 +251,67 @@ QJsonObject obj = yeasts.array().at(i).toObject(); Yeasts y; /* First some defaults for newer fields. */ - y.y_tolerance = y.y_harvest_time = y.y_pitch_temperature = y.y_zymocide = 0; - y.y_sta1 = y.y_bacteria = y.y_harvest_top = y.y_pofpos = false; - y.y_gr_hl_lo = 50; - y.y_sg_lo = 1.04; - y.y_gr_hl_hi = 80; - y.y_sg_hi = 1.08; + y.tolerance = y.harvest_time = y.pitch_temperature = y.zymocide = 0; + y.sta1 = y.bacteria = y.harvest_top = y.pofpos = false; + y.gr_hl_lo = 50; + y.sg_lo = 1.04; + y.gr_hl_hi = 80; + y.sg_hi = 1.08; /* Now get what we have got */ - y.y_name = obj["y_name"].toString(); - y.y_laboratory = obj["y_laboratory"].toString(); - y.y_product_id = obj["y_product_id"].toString(); - y.y_amount = obj["y_amount"].toDouble(); - y.y_type = obj["y_type"].toInt(); - y.y_form = obj["y_form"].toInt(); - y.y_min_temperature = obj["y_min_temperature"].toDouble(); - y.y_max_temperature = obj["y_max_temperature"].toDouble(); - y.y_flocculation = obj["y_flocculation"].toInt(); - y.y_attenuation = obj["y_attenuation"].toDouble(); - y.y_cells = obj["y_cells"].toDouble(); - y.y_tolerance = obj["y_tolerance"].toDouble(); - y.y_inventory = obj["y_inventory"].toDouble(); - y.y_use = obj["y_use"].toInt(); - y.y_sta1 = obj["y_sta1"].toInt() ? true:false; - y.y_bacteria = obj["y_bacteria"].toInt() ? true:false; - y.y_harvest_top = obj["y_harvest_top"].toInt() ? true:false; - y.y_harvest_time = obj["y_harvest_time"].toInt(); - y.y_pitch_temperature = obj["y_pitch_temperature"].toDouble(); - y.y_pofpos = obj["y_pofpos"].toInt() ? true:false; - y.y_zymocide = obj["y_zymocide"].toInt(); - y.y_gr_hl_lo = obj["y_gr_hl_lo"].toInt(); - y.y_sg_lo = obj["y_sg_lo"].toDouble(); - y.y_gr_hl_hi = obj["y_gr_hl_hi"].toInt(); - y.y_sg_hi = obj["y_sg_hi"].toDouble(); - y.y_cost = obj["y_cost"].toDouble(); + y.name = obj["y_name"].toString(); + y.laboratory = obj["y_laboratory"].toString(); + y.product_id = obj["y_product_id"].toString(); + y.amount = obj["y_amount"].toDouble(); + y.type = obj["y_type"].toInt(); + y.form = obj["y_form"].toInt(); + y.min_temperature = obj["y_min_temperature"].toDouble(); + y.max_temperature = obj["y_max_temperature"].toDouble(); + y.flocculation = obj["y_flocculation"].toInt(); + y.attenuation = obj["y_attenuation"].toDouble(); + y.cells = obj["y_cells"].toDouble(); + y.tolerance = obj["y_tolerance"].toDouble(); + y.inventory = obj["y_inventory"].toDouble(); + y.use = obj["y_use"].toInt(); + y.sta1 = obj["y_sta1"].toInt() ? true:false; + y.bacteria = obj["y_bacteria"].toInt() ? true:false; + y.harvest_top = obj["y_harvest_top"].toInt() ? true:false; + y.harvest_time = obj["y_harvest_time"].toInt(); + y.pitch_temperature = obj["y_pitch_temperature"].toDouble(); + y.pofpos = obj["y_pofpos"].toInt() ? true:false; + y.zymocide = obj["y_zymocide"].toInt(); + y.gr_hl_lo = obj["y_gr_hl_lo"].toInt(); + y.sg_lo = obj["y_sg_lo"].toDouble(); + y.gr_hl_hi = obj["y_gr_hl_hi"].toInt(); + y.sg_hi = obj["y_sg_hi"].toDouble(); + y.cost = obj["y_cost"].toDouble(); - if (y.y_tolerance == 0 || y.y_cells == 0) { // More and better tests? + if (y.tolerance == 0 || y.cells == 0) { // More and better tests? /* * Possible data upgrade needed. */ yquery.prepare("SELECT tolerance,cells,sta1,bacteria,harvest_top,harvest_time,pitch_temperature," "pofpos,zymocide,gr_hl_lo,sg_lo,gr_hl_hi,sg_hi " "FROM inventory_yeasts WHERE name=:name AND laboratory=:laboratory AND product_id=:product_id"); - yquery.bindValue(":name", y.y_name); - yquery.bindValue(":laboratory", y.y_laboratory); - yquery.bindValue(":product_id", y.y_product_id); + yquery.bindValue(":name", y.name); + yquery.bindValue(":laboratory", y.laboratory); + yquery.bindValue(":product_id", y.product_id); yquery.exec(); if (yquery.first()) { - y.y_tolerance = yquery.value(0).toDouble(); - y.y_cells = yquery.value(1).toDouble(); - y.y_sta1 = yquery.value(2).toInt() ? true:false; - y.y_bacteria = yquery.value(3).toInt() ? true:false; - y.y_harvest_top = yquery.value(4).toInt() ? true:false; - y.y_harvest_time = yquery.value(5).toInt(); - y.y_pitch_temperature = yquery.value(6).toDouble(); - y.y_pofpos = yquery.value(7).toInt() ? true:false; - y.y_zymocide = yquery.value(8).toInt(); - y.y_gr_hl_lo = yquery.value(9).toInt(); - y.y_sg_lo = yquery.value(10).toDouble(); - y.y_gr_hl_hi = yquery.value(11).toInt(); - y.y_sg_hi = yquery.value(12).toDouble(); + y.tolerance = yquery.value(0).toDouble(); + y.cells = yquery.value(1).toDouble(); + y.sta1 = yquery.value(2).toInt() ? true:false; + y.bacteria = yquery.value(3).toInt() ? true:false; + y.harvest_top = yquery.value(4).toInt() ? true:false; + y.harvest_time = yquery.value(5).toInt(); + y.pitch_temperature = yquery.value(6).toDouble(); + y.pofpos = yquery.value(7).toInt() ? true:false; + y.zymocide = yquery.value(8).toInt(); + y.gr_hl_lo = yquery.value(9).toInt(); + y.sg_lo = yquery.value(10).toDouble(); + y.gr_hl_hi = yquery.value(11).toInt(); + y.sg_hi = yquery.value(12).toDouble(); } else { - qDebug() << y.y_name << y.y_product_id << "not found for upgrade"; + qDebug() << y.name << y.product_id << "not found for upgrade"; } } reci->yeasts.append(y); @@ -569,32 +569,32 @@ QJsonArray array; for (int i = 0; i < reci->yeasts.size(); i++) { QJsonObject obj; - obj.insert("y_name", reci->yeasts.at(i).y_name); - obj.insert("y_laboratory", reci->yeasts.at(i).y_laboratory); - obj.insert("y_product_id", reci->yeasts.at(i).y_product_id); - obj.insert("y_amount", round(reci->yeasts.at(i).y_amount * 10000) / 10000); - obj.insert("y_type", reci->yeasts.at(i).y_type); - obj.insert("y_form", reci->yeasts.at(i).y_form); - obj.insert("y_min_temperature", round(reci->yeasts.at(i).y_min_temperature * 10) / 10); - obj.insert("y_max_temperature", round(reci->yeasts.at(i).y_max_temperature * 10) / 10); - obj.insert("y_flocculation", reci->yeasts.at(i).y_flocculation); - obj.insert("y_attenuation", round(reci->yeasts.at(i).y_attenuation * 10) / 10); - obj.insert("y_cells", reci->yeasts.at(i).y_cells); - obj.insert("y_tolerance", round(reci->yeasts.at(i).y_tolerance * 10) / 10); - obj.insert("y_inventory", round(reci->yeasts.at(i).y_inventory * 10000) / 10000); - obj.insert("y_use", reci->yeasts.at(i).y_use); - obj.insert("y_sta1", reci->yeasts.at(i).y_sta1 ? 1:0); - obj.insert("y_bacteria", reci->yeasts.at(i).y_bacteria ? 1:0); - obj.insert("y_harvest_top", reci->yeasts.at(i).y_harvest_top ? 1:0); - obj.insert("y_harvest_time", reci->yeasts.at(i).y_harvest_time); - obj.insert("y_pitch_temperature", round(reci->yeasts.at(i).y_pitch_temperature * 10) / 10); - obj.insert("y_pofpos", reci->yeasts.at(i).y_pofpos ? 1:0); - obj.insert("y_zymocide", reci->yeasts.at(i).y_zymocide); - obj.insert("y_gr_hl_lo", reci->yeasts.at(i).y_gr_hl_lo); - obj.insert("y_sg_lo", round(reci->yeasts.at(i).y_sg_lo * 1000) / 1000); - obj.insert("y_gr_hl_hi", reci->yeasts.at(i).y_gr_hl_hi); - obj.insert("y_sg_hi", round(reci->yeasts.at(i).y_sg_hi * 1000) / 1000); - obj.insert("y_cost", round(reci->yeasts.at(i).y_cost * 1000) / 1000); + obj.insert("y_name", reci->yeasts.at(i).name); + obj.insert("y_laboratory", reci->yeasts.at(i).laboratory); + obj.insert("y_product_id", reci->yeasts.at(i).product_id); + obj.insert("y_amount", round(reci->yeasts.at(i).amount * 10000) / 10000); + obj.insert("y_type", reci->yeasts.at(i).type); + obj.insert("y_form", reci->yeasts.at(i).form); + obj.insert("y_min_temperature", round(reci->yeasts.at(i).min_temperature * 10) / 10); + obj.insert("y_max_temperature", round(reci->yeasts.at(i).max_temperature * 10) / 10); + obj.insert("y_flocculation", reci->yeasts.at(i).flocculation); + obj.insert("y_attenuation", round(reci->yeasts.at(i).attenuation * 10) / 10); + obj.insert("y_cells", reci->yeasts.at(i).cells); + obj.insert("y_tolerance", round(reci->yeasts.at(i).tolerance * 10) / 10); + obj.insert("y_inventory", round(reci->yeasts.at(i).inventory * 10000) / 10000); + obj.insert("y_use", reci->yeasts.at(i).use); + obj.insert("y_sta1", reci->yeasts.at(i).sta1 ? 1:0); + obj.insert("y_bacteria", reci->yeasts.at(i).bacteria ? 1:0); + obj.insert("y_harvest_top", reci->yeasts.at(i).harvest_top ? 1:0); + obj.insert("y_harvest_time", reci->yeasts.at(i).harvest_time); + obj.insert("y_pitch_temperature", round(reci->yeasts.at(i).pitch_temperature * 10) / 10); + obj.insert("y_pofpos", reci->yeasts.at(i).pofpos ? 1:0); + obj.insert("y_zymocide", reci->yeasts.at(i).zymocide); + obj.insert("y_gr_hl_lo", reci->yeasts.at(i).gr_hl_lo); + obj.insert("y_sg_lo", round(reci->yeasts.at(i).sg_lo * 1000) / 1000); + obj.insert("y_gr_hl_hi", reci->yeasts.at(i).gr_hl_hi); + obj.insert("y_sg_hi", round(reci->yeasts.at(i).sg_hi * 1000) / 1000); + obj.insert("y_cost", round(reci->yeasts.at(i).cost * 1000) / 1000); array.append(obj); /* Append this object */ } QJsonDocument doc;
--- a/src/global.h Mon Jun 13 16:47:52 2022 +0200 +++ b/src/global.h Mon Jun 13 17:34:51 2022 +0200 @@ -129,33 +129,33 @@ struct Yeasts { - QString y_name; - QString y_laboratory; - QString y_product_id; - double y_amount; - int y_type; - int y_form; - double y_min_temperature; - double y_max_temperature; - int y_flocculation; - double y_attenuation; - double y_cells; - double y_tolerance; - int y_use; - bool y_sta1; - bool y_bacteria; - bool y_harvest_top; - int y_harvest_time; - double y_pitch_temperature; - bool y_pofpos; - int y_zymocide; - int y_gr_hl_lo; - double y_sg_lo; - int y_gr_hl_hi; - double y_sg_hi; - double y_cost; - double y_inventory; ///< In product, current inventory. - bool y_avail; ///< Product available in database. + QString name; + QString laboratory; + QString product_id; + double amount; + int type; + int form; + double min_temperature; + double max_temperature; + int flocculation; + double attenuation; + double cells; + double tolerance; + int use; + bool sta1; + bool bacteria; + bool harvest_top; + int harvest_time; + double pitch_temperature; + bool pofpos; + int zymocide; + int gr_hl_lo; + double sg_lo; + int gr_hl_hi; + double sg_hi; + double cost; + double inventory; ///< In product, current inventory. + bool avail; ///< Product available in database. };