Fix export recipe to new product crash

Mon, 04 Mar 2024 19:48:59 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 04 Mar 2024 19:48:59 +0100
changeset 519
1b9e887392aa
parent 518
6922856f4288
child 520
9166c0b82ada

Fix export recipe to new product crash

src/database/db_product.cpp file | annotate | diff | comparison | revisions
src/database/db_recipe.cpp file | annotate | diff | comparison | revisions
translations/bmsapp_en.ts file | annotate | diff | comparison | revisions
translations/bmsapp_nl.ts file | annotate | diff | comparison | revisions
--- a/src/database/db_product.cpp	Tue Feb 27 17:32:00 2024 +0100
+++ b/src/database/db_product.cpp	Mon Mar 04 19:48:59 2024 +0100
@@ -679,12 +679,8 @@
     query.bindValue(":eq_trub_loss", round(prod->eq_trub_loss * 10) / 10);
     query.bindValue(":eq_evap_rate", round(prod->eq_evap_rate * 100) / 100);
     query.bindValue(":eq_boil_time", round(prod->eq_boil_time));
-    //query.bindValue(":eq_calcboil", prod->eq_calc_boil_volume ? 1:0);
     query.bindValue(":eq_top_up_kettle", round(prod->eq_top_up_kettle * 10) / 10);
-    //query.bindValue(":eq_hopfactor", round(prod->eq_hop_utilization));
     query.bindValue(":eq_notes", prod->eq_notes);
-    //query.bindValue(":eq_lauter_volume", round(prod->eq_lauter_volume * 10) / 10);
-    //query.bindValue(":eq_lauter_height", round(prod->eq_lauter_height * 1000) / 1000);
     query.bindValue(":eq_lauter_deadspace", round(prod->eq_lauter_deadspace * 10) / 10);
     query.bindValue(":eq_kettle_volume", round(prod->eq_kettle_volume * 10) / 10);
     query.bindValue(":eq_kettle_height", round(prod->eq_kettle_height * 1000) / 1000);
@@ -992,7 +988,7 @@
 		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);
-		if (! product->yeasts.at(i).yp_uuid.isNull() && (product->yeasts.at(i).yp_uuid.length() == 36)) {
+		if (! prod->yeasts.at(i).yp_uuid.isNull() && (prod->yeasts.at(i).yp_uuid.length() == 36)) {
 //		    qDebug() << "yeasts_Json append package";
 		    QJsonObject package;
 		    package.insert("uuid", prod->yeasts.at(i).yp_uuid);
--- a/src/database/db_recipe.cpp	Tue Feb 27 17:32:00 2024 +0100
+++ b/src/database/db_recipe.cpp	Mon Mar 04 19:48:59 2024 +0100
@@ -273,6 +273,13 @@
                 y.sg_lo = 1.04;
                 y.gr_hl_hi = 80;
                 y.sg_hi = 1.08;
+		/* Clear Yeast Package data */
+                y.yp_uuid = QString();
+                y.yp_package = QString();
+                y.yp_cells = 0;
+                y.yp_viability = 0.99;
+                y.yp_max = 100;
+                y.yp_size = 0.01;
 		/* Now get what we have got */
 		y.name = obj["y_name"].toString();
 		y.laboratory = obj["y_laboratory"].toString();
--- a/translations/bmsapp_en.ts	Tue Feb 27 17:32:00 2024 +0100
+++ b/translations/bmsapp_en.ts	Mon Mar 04 19:48:59 2024 +0100
@@ -12481,11 +12481,11 @@
     <name>QObject</name>
     <message>
         <location filename="../src/database/db_recipe.cpp" line="31"/>
-        <location filename="../src/database/db_recipe.cpp" line="654"/>
-        <location filename="../src/database/db_recipe.cpp" line="687"/>
+        <location filename="../src/database/db_recipe.cpp" line="661"/>
+        <location filename="../src/database/db_recipe.cpp" line="694"/>
         <location filename="../src/database/db_product.cpp" line="31"/>
-        <location filename="../src/database/db_product.cpp" line="1048"/>
-        <location filename="../src/database/db_product.cpp" line="1081"/>
+        <location filename="../src/database/db_product.cpp" line="1044"/>
+        <location filename="../src/database/db_product.cpp" line="1077"/>
         <source>Database error</source>
         <translation type="unfinished"></translation>
     </message>
@@ -12496,10 +12496,10 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/db_recipe.cpp" line="655"/>
-        <location filename="../src/database/db_recipe.cpp" line="688"/>
-        <location filename="../src/database/db_product.cpp" line="1049"/>
-        <location filename="../src/database/db_product.cpp" line="1082"/>
+        <location filename="../src/database/db_recipe.cpp" line="662"/>
+        <location filename="../src/database/db_recipe.cpp" line="695"/>
+        <location filename="../src/database/db_product.cpp" line="1045"/>
+        <location filename="../src/database/db_product.cpp" line="1078"/>
         <source>MySQL error: %1
 %2
 %3</source>
--- a/translations/bmsapp_nl.ts	Tue Feb 27 17:32:00 2024 +0100
+++ b/translations/bmsapp_nl.ts	Mon Mar 04 19:48:59 2024 +0100
@@ -14173,11 +14173,11 @@
     </message>
     <message>
         <location filename="../src/database/db_recipe.cpp" line="31"/>
-        <location filename="../src/database/db_recipe.cpp" line="654"/>
-        <location filename="../src/database/db_recipe.cpp" line="687"/>
+        <location filename="../src/database/db_recipe.cpp" line="661"/>
+        <location filename="../src/database/db_recipe.cpp" line="694"/>
         <location filename="../src/database/db_product.cpp" line="31"/>
-        <location filename="../src/database/db_product.cpp" line="1048"/>
-        <location filename="../src/database/db_product.cpp" line="1081"/>
+        <location filename="../src/database/db_product.cpp" line="1044"/>
+        <location filename="../src/database/db_product.cpp" line="1077"/>
         <source>Database error</source>
         <translation>Database fout</translation>
     </message>
@@ -14188,10 +14188,10 @@
         <translation>MySQL fout: record %1 niet gevonden</translation>
     </message>
     <message>
-        <location filename="../src/database/db_recipe.cpp" line="655"/>
-        <location filename="../src/database/db_recipe.cpp" line="688"/>
-        <location filename="../src/database/db_product.cpp" line="1049"/>
-        <location filename="../src/database/db_product.cpp" line="1082"/>
+        <location filename="../src/database/db_recipe.cpp" line="662"/>
+        <location filename="../src/database/db_recipe.cpp" line="695"/>
+        <location filename="../src/database/db_product.cpp" line="1045"/>
+        <location filename="../src/database/db_product.cpp" line="1078"/>
         <source>MySQL error: %1
 %2
 %3</source>

mercurial