Added valid flag to the inventory_yeastpack table. Initial false and after record edit set to true. This should prevent the use possible wrong values.

Tue, 31 Jan 2023 11:10:14 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 31 Jan 2023 11:10:14 +0100
changeset 481
8a25dbe682eb
parent 480
94b3def5d778
child 482
e13763ec829f

Added valid flag to the inventory_yeastpack table. Initial false and after record edit set to true. This should prevent the use possible wrong values.

src/EditYeastPack.cpp file | annotate | diff | comparison | revisions
src/MainWindow.cpp file | annotate | diff | comparison | revisions
--- a/src/EditYeastPack.cpp	Mon Jan 30 17:05:13 2023 +0100
+++ b/src/EditYeastPack.cpp	Tue Jan 31 11:10:14 2023 +0100
@@ -122,11 +122,11 @@
     	if (this->recno == -1) {
     	    query.prepare("INSERT INTO inventory_yeastpack SET laboratory=:laboratory, form=:form, "
 		"package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, "
-		"size=:size, used='0', uuid = :uuid");
+		"size=:size, used='0', valid='1', uuid = :uuid");
     	} else {
 	    query.prepare("UPDATE inventory_yeastpack SET laboratory=:laboratory, form=:form, "
 		"package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, "
-                "size=:size WHERE record = :recno");
+                "size=:size, valid='1' WHERE record = :recno");
     	}
 	query.bindValue(":laboratory", ui->laboratoryEdit->text());
 	query.bindValue(":form", ui->formEdit->currentIndex());
@@ -165,7 +165,7 @@
     QSqlQuery query;
     query.prepare("INSERT INTO inventory_yeastpack SET laboratory=:laboratory, form=:form, "
                 "package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, "
-                "size=:size, used=:used, uuid=:uuid");
+                "size=:size, used=:used, valid='0', uuid=:uuid");
     query.bindValue(":laboratory", ui->laboratoryEdit->text());
     query.bindValue(":form", ui->formEdit->currentIndex());
     query.bindValue(":package", ui->packageEdit->text() + " [copy]");
--- a/src/MainWindow.cpp	Mon Jan 30 17:05:13 2023 +0100
+++ b/src/MainWindow.cpp	Tue Jan 31 11:10:14 2023 +0100
@@ -186,6 +186,7 @@
 		"`max` tinyint(4) NOT NULL DEFAULT 100,"
   		"`size` float NOT NULL DEFAULT 0,"
 		"`used` int(11) NOT NULL DEFAULT 0,"
+		"`valid` tinyint(1) NOT NULL DEFAULT 0,"
   		"PRIMARY KEY (`record`),"
   		"UNIQUE KEY `uuid` (`uuid`),"
 		"UNIQUE KEY `package` (`laboratory`,`form`,`package`),"

mercurial