src/EditProductTab6.cpp

changeset 486
f1cc6a30623d
parent 484
ebf7ef31da35
child 487
04c67c9f903c
--- a/src/EditProductTab6.cpp	Thu Feb 02 17:14:28 2023 +0100
+++ b/src/EditProductTab6.cpp	Fri Feb 03 11:59:17 2023 +0100
@@ -295,18 +295,22 @@
 #endif
 		}
 
-		initcells = (product->yeasts.at(i).cells / 1000000) * product->yeasts.at(i).amount * (product->starter_viability / 100.0);
+		double cells = product->yeasts.at(i).cells;
+		if (product->yeasts.at(i).yp_cells > 0) {	// Use from yeastpack if set
+		    cells = product->yeasts.at(i).yp_cells;
+		}
+		initcells = (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);
+		    initcells = (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);
-		if (needed > initcells) {
+		if ((0.9 * needed) > initcells) {	// Allow 90% underpitch without a starter
 		    maybe_starter = true;
 		}
 
 #ifdef DEBUG_YEAST
-		qDebug() << "  Pitchrate:" << product->yeast_pitchrate << "needed:" << needed << "initcells:" << initcells << "starter" << maybe_starter;
+		qDebug() << "  Pitchrate:" << product->yeast_pitchrate << "needed:" << 0.9 * needed << "/" << needed << "initcells:" << initcells << "starter" << maybe_starter;
 #endif
 	    }
 	    break;
@@ -337,6 +341,8 @@
 
 	const QStringList labels({tr("Method"), tr("Volume"), tr("Inj. factor"), tr("New cells"), tr("Total cells"), tr("Grow factor"), "" });
 	ui->starterTable->show();
+	ui->restartLabel->show();
+	ui->restartButton->show();
 	ui->starterTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
 	ui->starterTable->clear();
 	ui->starterTable->setColumnCount(7);
@@ -352,6 +358,8 @@
 	calcSteps(product->starter_type, initcells, needed);
     } else {
 	ui->starterTable->hide();
+	ui->restartLabel->hide();
+	ui->restartButton->hide();
     }
     calcBU();
 }

mercurial