# HG changeset patch # User Michiel Broek # Date 1652295848 -7200 # Node ID bbab7d37d12f0d4fd01ab14096415becc77b49c7 # Parent 59b0bdbb2f9f9bbfda1c6e27c4c0f9fb941159ba Dry yeast use yeast viability. Finished calculate dry yeast. Finished using enum values. diff -r 59b0bdbb2f9f -r bbab7d37d12f src/EditProductTab6.cpp --- a/src/EditProductTab6.cpp Wed May 11 11:33:29 2022 +0200 +++ b/src/EditProductTab6.cpp Wed May 11 21:04:08 2022 +0200 @@ -181,9 +181,6 @@ volume = product->batch_size - product->eq_trub_chiller_loss; } - // Also in calcFermentables() - //$('#yeast_cells').val(initcells); - if (product->yeasts.size() == 0) return; // No yeast in product. @@ -206,11 +203,15 @@ 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) / 100.0; // * (100 / dataRecord.starter_viability), 2); + 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; - ui->need_grEdit->setValue(yeast_grams); - ui->pitch_grEdit->setValue(yeast_gr_hl); - qDebug() << " need" << yeast_grams << "grams, gr/hl:" << yeast_gr_hl; + double pitch_gr_hl = round(((product->yeasts.at(i).y_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); + ui->pitch_grShow->setStyleSheet((pitch_gr_hl < yeast_gr_hl) ? "background-color: red":""); + + qDebug() << " need" << yeast_grams << "grams, gr/hl:" << yeast_gr_hl << "pitch:" << pitch_gr_hl; return; } else { /* @@ -506,18 +507,18 @@ double max = 100; for (int i = 0; i < product->yeasts.size(); i++) { - if (product->yeasts.at(i).y_use == 0) { - if (product->yeasts.at(i).y_form == 0) { // Liquid + if (product->yeasts.at(i).y_use == YEAST_USE_PRIMARY) { + if (product->yeasts.at(i).y_form == YEAST_FORMS_LIQUID) { vpm = 0.80; max = 97; - if (product->yeasts.at(i).y_laboratory == "White Labs") { // PurePitch + if (product->yeasts.at(i).y_laboratory == "White Labs") { // PurePitch vpm = 0.95; max = 100; } - } else if (product->yeasts.at(i).y_form == 1) { // dry + } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRY) { vpm = 0.998; max = 100; - } else if (product->yeasts.at(i).y_form == 6) { // dried kveik + } else if (product->yeasts.at(i).y_form == YEAST_FORMS_DRIED) { // dried kveik vpm = 0.92; max = 100; } else { // Slant, Culture, Frozen, Bottle @@ -676,8 +677,8 @@ newy.y_laboratory = ""; newy.y_product_id = ""; newy.y_amount = 0; - newy.y_type = 0; - newy.y_form = 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; @@ -685,7 +686,7 @@ newy.y_cells = 0; newy.y_tolerance = 0; newy.y_inventory = 0; - newy.y_use = 0; + newy.y_use = YEAST_USE_PRIMARY; newy.y_sta1 = false; newy.y_bacteria = false; newy.y_harvest_top = false; @@ -730,10 +731,11 @@ qDebug() << "yeast_amount_changed()" << product->yeasts_row << val; - if (product->yeasts.at(product->yeasts_row).y_form == 0) { + if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) { product->yeasts[product->yeasts_row].y_amount = val; item = new QTableWidgetItem(QString("%1 pack").arg(val, 1, 'f', 0, '0')); - } else if (product->yeasts.at(product->yeasts_row).y_form == 1) { + } 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; item = new QTableWidgetItem(QString("%1 gr").arg(val, 3, 'f', 2, '0')); } else { @@ -810,11 +812,11 @@ 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 == 0) { + if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) { yamountEdit->setDecimals(0); yamountEdit->setSingleStep(1.0); yamountLabel->setText(tr("Total packs:")); - } else if (product->yeasts.at(product->yeasts_row).y_form == 1) { + } 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->setDecimals(1); yamountEdit->setSingleStep(0.5); yamountLabel->setText(tr("Amount in gr:")); @@ -939,9 +941,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 == 0) + if (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_LIQUID) yamountLabel->setText(tr("Total packs:")); - else if (product->yeasts.at(product->yeasts_row).y_form == 1) + else if ((product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRY) || (product->yeasts.at(product->yeasts_row).y_form == YEAST_FORMS_DRIED)) yamountLabel->setText(tr("Amount in gr:")); else yamountLabel->setText(tr("Amount in ml:")); @@ -980,11 +982,11 @@ yamountEdit->setGeometry(QRect(160, 130, 121, 24)); yamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); yamountEdit->setAccelerated(true); - if (product->yeasts.at(product->yeasts_row).y_form == 0) { + if (product->yeasts.at(product->yeasts_row).y_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 == 1) { + } 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->setDecimals(1); yamountEdit->setSingleStep(0.5); yamountEdit->setValue(product->yeasts.at(product->yeasts_row).y_amount * 1000.0); diff -r 59b0bdbb2f9f -r bbab7d37d12f ui/EditProduct.ui --- a/ui/EditProduct.ui Wed May 11 11:33:29 2022 +0200 +++ b/ui/EditProduct.ui Wed May 11 21:04:08 2022 +0200 @@ -2982,7 +2982,7 @@ - Pitchrate million cells/ml/°P: + Pitchrate billion cells/ml/°P: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -3113,7 +3113,7 @@ - Need million cells: + Need billion cells: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -3169,7 +3169,7 @@ - Dry yeast advice + Dry yeast claculation. @@ -3339,28 +3339,88 @@ 2.000000000000000 - + - 40 + 390 120 - 121 + 181 20 - Pitch grams: + This recipe pitch grams/hl: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + + + + 580 + 60 + 91 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + QAbstractSpinBox::NoButtons + + + false + + + 2 + + + 1000.000000000000000 + + + - 170 - 120 - 61 + 390 + 60 + 181 + 20 + + + + Pitchrate grams/hectoliter: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 390 + 90 + 181 + 20 + + + + Yeast grams needed: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 580 + 90 + 91 24 @@ -3380,31 +3440,18 @@ 1 - 1000.000000000000000 + 100000.000000000000000 + + + 0.000000000000000 - + - 40 - 150 - 121 - 20 - - - - Pitch grams/hl: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 170 - 150 - 61 + 580 + 120 + 91 24