From 6aa95dfde3f5a00e8739879c74903a5634a0cdb9 Mon Sep 17 00:00:00 2001 From: ftomei Date: Fri, 17 May 2024 19:19:45 +0200 Subject: [PATCH 1/2] fix soil warning --- soil/soil.cpp | 2 +- soil/soilDbTools.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/soil/soil.cpp b/soil/soil.cpp index c0472e58..f4ce8b9e 100644 --- a/soil/soil.cpp +++ b/soil/soil.cpp @@ -824,7 +824,7 @@ namespace soil horizon.texture.classUSDA = soil::getUSDATextureClass(horizon.texture); if (horizon.texture.classUSDA == NODATA) { - errorStr = "sand+silt+clay <> 100"; + //errorStr = "sand+silt+clay <> 100"; return false; } diff --git a/soil/soilDbTools.cpp b/soil/soilDbTools.cpp index 7b72d803..06fd0a3a 100644 --- a/soil/soilDbTools.cpp +++ b/soil/soilDbTools.cpp @@ -375,12 +375,16 @@ bool loadSoil(const QSqlDatabase &dbSoil, const QString &soilCode, soil::Crit3DS } else { - errorStr += "\n"; + if (horizonError != "") + errorStr += "\n"; } - errorStr += "soil_code: " + soilCode + if (horizonError != "") + { + errorStr += "soil_code: " + soilCode + " horizon nr." + QString::number(mySoil.horizon[i].dbData.horizonNr) + " " + QString::fromStdString(horizonError); + } } } From d5cfe755fcc53b9b045a66a94534febe7884160c Mon Sep 17 00:00:00 2001 From: ftomei Date: Fri, 17 May 2024 19:43:24 +0200 Subject: [PATCH 2/2] fix irrigation change --- criteria1DWidget/criteria1DWidget.cpp | 7 +------ soil/soil.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/criteria1DWidget/criteria1DWidget.cpp b/criteria1DWidget/criteria1DWidget.cpp index b27dc0c2..627a0ae8 100644 --- a/criteria1DWidget/criteria1DWidget.cpp +++ b/criteria1DWidget/criteria1DWidget.cpp @@ -2111,27 +2111,22 @@ bool Criteria1DWidget::checkCropIsChanged() return isCropChanged; } + void Criteria1DWidget::irrigationVolumeChanged() { double irrigationVolume = QLocale().toDouble(irrigationVolumeValue->text()); if (irrigationVolume == 0) { - irrigationShiftValue->setValue(0); irrigationShiftValue->setEnabled(false); - degreeDaysStartValue->setText(nullptr); degreeDaysStartValue->setEnabled(false); - degreeDaysEndValue->setText(nullptr); degreeDaysEndValue->setEnabled(false); } else if (irrigationVolume > 0) { irrigationShiftValue->setEnabled(true); - irrigationShiftValue->setValue(cropFromDB.irrigationShift); degreeDaysStartValue->setEnabled(true); - degreeDaysStartValue->setText(QString::number(cropFromDB.degreeDaysStartIrrigation)); degreeDaysEndValue->setEnabled(true); - degreeDaysEndValue->setText(QString::number(cropFromDB.degreeDaysEndIrrigation)); } } diff --git a/soil/soil.cpp b/soil/soil.cpp index f4ce8b9e..87e42a3e 100644 --- a/soil/soil.cpp +++ b/soil/soil.cpp @@ -813,7 +813,8 @@ namespace soil horizon.texture.sand = horizon.dbData.sand; horizon.texture.silt = horizon.dbData.silt; horizon.texture.clay = horizon.dbData.clay; - if (horizon.texture.sand <= 1 && horizon.texture.silt <= 1 && horizon.texture.clay <= 1) + if (! isEqual(horizon.texture.sand, NODATA) && ! isEqual(horizon.texture.silt, NODATA) && ! isEqual(horizon.texture.clay, NODATA) + && (horizon.texture.sand + horizon.texture.silt + horizon.texture.clay) <= 1 ) { horizon.texture.sand *= 100; horizon.texture.silt *= 100; @@ -824,7 +825,10 @@ namespace soil horizon.texture.classUSDA = soil::getUSDATextureClass(horizon.texture); if (horizon.texture.classUSDA == NODATA) { - //errorStr = "sand+silt+clay <> 100"; + if (! isEqual(horizon.texture.sand, NODATA) || ! isEqual(horizon.texture.silt, NODATA) || ! isEqual(horizon.texture.clay, NODATA)) + { + errorStr = "sand+silt+clay <> 100"; + } return false; }