Wed, 11 May 2022 21:04:08 +0200
Dry yeast use yeast viability. Finished calculate dry yeast. Finished using enum values.
src/EditProductTab6.cpp | file | annotate | diff | comparison | revisions | |
ui/EditProduct.ui | file | annotate | diff | comparison | revisions |
--- 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);
--- 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 @@ </rect> </property> <property name="text"> - <string>Pitchrate million cells/ml/°P:</string> + <string>Pitchrate billion cells/ml/°P:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> @@ -3113,7 +3113,7 @@ </rect> </property> <property name="text"> - <string>Need million cells:</string> + <string>Need billion cells:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> @@ -3169,7 +3169,7 @@ </font> </property> <property name="text"> - <string>Dry yeast advice</string> + <string>Dry yeast claculation.</string> </property> </widget> <widget class="QLabel" name="lo_gr_hlLabel"> @@ -3339,28 +3339,88 @@ <double>2.000000000000000</double> </property> </widget> - <widget class="QLabel" name="need_grLabel"> + <widget class="QLabel" name="pitch_grLabel"> <property name="geometry"> <rect> - <x>40</x> + <x>390</x> <y>120</y> - <width>121</width> + <width>181</width> <height>20</height> </rect> </property> <property name="text"> - <string>Pitch grams:</string> + <string>This recipe pitch grams/hl:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> - <widget class="QDoubleSpinBox" name="need_grEdit"> + <widget class="QDoubleSpinBox" name="dry_pitchrateShow"> + <property name="geometry"> + <rect> + <x>580</x> + <y>60</y> + <width>91</width> + <height>24</height> + </rect> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::NoButtons</enum> + </property> + <property name="accelerated"> + <bool>false</bool> + </property> + <property name="decimals"> + <number>2</number> + </property> + <property name="maximum"> + <double>1000.000000000000000</double> + </property> + </widget> + <widget class="QLabel" name="dry_pitchrateLabel"> <property name="geometry"> <rect> - <x>170</x> - <y>120</y> - <width>61</width> + <x>390</x> + <y>60</y> + <width>181</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Pitchrate grams/hectoliter:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="dry_needLabel"> + <property name="geometry"> + <rect> + <x>390</x> + <y>90</y> + <width>181</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Yeast grams needed:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QDoubleSpinBox" name="dry_needShow"> + <property name="geometry"> + <rect> + <x>580</x> + <y>90</y> + <width>91</width> <height>24</height> </rect> </property> @@ -3380,31 +3440,18 @@ <number>1</number> </property> <property name="maximum"> - <double>1000.000000000000000</double> + <double>100000.000000000000000</double> + </property> + <property name="value"> + <double>0.000000000000000</double> </property> </widget> - <widget class="QLabel" name="pitch_grLabel"> + <widget class="QDoubleSpinBox" name="pitch_grShow"> <property name="geometry"> <rect> - <x>40</x> - <y>150</y> - <width>121</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Pitch grams/hl:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - <widget class="QDoubleSpinBox" name="pitch_grEdit"> - <property name="geometry"> - <rect> - <x>170</x> - <y>150</y> - <width>61</width> + <x>580</x> + <y>120</y> + <width>91</width> <height>24</height> </rect> </property>