src/database/db_recipe.cpp

changeset 256
c136bd15b084
parent 249
3c28dc8dd51d
child 262
6bab9440aeb9
--- a/src/database/db_recipe.cpp	Sun Jun 05 20:54:58 2022 +0200
+++ b/src/database/db_recipe.cpp	Sun Jun 05 21:10:06 2022 +0200
@@ -27,7 +27,7 @@
     query.bindValue(":recno", recno);
     query.exec();
     if (! query.first()) {
-	qDebug() << "loadRecipe seek error record" << recno;
+	qWarning() << "loadRecipe seek error record" << recno;
 	QMessageBox::warning(dialog, QObject::tr("Database error"), QObject::tr("MySQL error: record %1 not found").arg(recno));
 	dialog->done(QDialog::Rejected);	// At this stage, this doesn't work because the dialog is not yet visible.
 	return false;
@@ -132,7 +132,7 @@
 	const auto& formattedJson = QString("%1").arg(f_json);
 	QJsonDocument fermentables = QJsonDocument::fromJson(formattedJson.toUtf8(),  &parseError);
 	if (parseError.error != QJsonParseError::NoError) {
-            qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
+            qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
 	} else if (fermentables.isArray()) {
 	    double percentcheck = 0;
 	    for (int i = 0; i < fermentables.array().size(); i++) {
@@ -176,7 +176,7 @@
 			if (reci->fermentables.at(i).f_added < 4)
 			    reci->fermentables[i].f_percentage = round((reci->fermentables.at(i).f_amount / total) * 10000.0) / 100.0;
 		}
-		qDebug() << " fixed missing percentages";
+		qInfo() << "fixed missing percentages";
 	    }
 	}
     } else {
@@ -188,7 +188,7 @@
         const auto& formattedJson = QString("%1").arg(h_json);
         QJsonDocument hops = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
         if (parseError.error != QJsonParseError::NoError) {
-            qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
+            qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
 	} else if (hops.isArray()) {
 	    for (int i = 0; i < hops.array().size(); i++) {
 		QJsonObject obj = hops.array().at(i).toObject();
@@ -221,7 +221,7 @@
 	const auto& formattedJson = QString("%1").arg(m_json);
 	QJsonDocument miscs = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
 	if (parseError.error != QJsonParseError::NoError) {
-	    qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
+	    qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset;
 	} else if (miscs.isArray()) {
 	    for (int i = 0; i < miscs.array().size(); i++) {
 		QJsonObject obj = miscs.array().at(i).toObject();
@@ -245,7 +245,7 @@
 	const auto& formattedJson = QString("%1").arg(y_json);
 	QJsonDocument yeasts = QJsonDocument::fromJson(formattedJson.toUtf8(),  &parseError);
 	if (parseError.error != QJsonParseError::NoError) {
-	    qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
+	    qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
 	} else if (yeasts.isArray()) {
 	    for (int i = 0; i < yeasts.array().size(); i++) {
 		QJsonObject obj = yeasts.array().at(i).toObject();
@@ -326,7 +326,7 @@
 	const auto& formattedJson = QString("%1").arg(ma_json);
 	QJsonDocument mashs = QJsonDocument::fromJson(formattedJson.toUtf8(),  &parseError);
 	if (parseError.error != QJsonParseError::NoError) {
-	    qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
+	    qWarning() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ;
 	} else if (mashs.isArray()) {
 	    for (int i = 0; i < mashs.array().size(); i++) {
             	QJsonObject obj = mashs.array().at(i).toObject();
@@ -348,7 +348,7 @@
 	qDebug() << "empty mashs";
     }
 
-    qDebug() << "loadRecipe" << reci->record << "done";
+    qInfo() << "loadRecipe" << reci->record << "done";
     return true;
 }
 
@@ -649,7 +649,7 @@
     query.exec();
     qDebug() << query.lastQuery();
     if (query.lastError().isValid()) {
-	qDebug() << "EditRecipe" << query.lastError();
+	qWarning() << "EditRecipe" << query.lastError();
 	QMessageBox::warning(dialog, QObject::tr("Database error"),
                         QObject::tr("MySQL error: %1\n%2\n%3")
                         .arg(query.lastError().nativeErrorCode())
@@ -665,9 +665,9 @@
 	if (reci->record < 0) {
 	    QVariant id = query.lastInsertId();
 	    reci->record = id.toInt();
-	    qDebug() << "saveRecipe Inserted record" << reci->record;
+	    qInfo() << "saveRecipe Inserted record" << reci->record;
 	} else {
-	    qDebug() << "saveRecipe Updated record" << reci->record;
+	    qInfo() << "saveRecipe Updated record" << reci->record;
 	}
     }
     return true;
@@ -682,7 +682,7 @@
     query.bindValue(":recno", recno);
     query.exec();
     if (query.lastError().isValid()) {
-	qDebug() << "deleteRecipe" << query.lastError();
+	qWarning() << "deleteRecipe" << query.lastError();
 	QMessageBox::warning(dialog, QObject::tr("Database error"),
                         QObject::tr("MySQL error: %1\n%2\n%3")
                         .arg(query.lastError().nativeErrorCode())
@@ -691,7 +691,7 @@
 	return false;
     }
 
-    qDebug() << "deleteRecipe Deleted" << recno;
+    qInfo() << "deleteRecipe Deleted" << recno;
     return true;
 }
 

mercurial