From a904529617aca62df4113c466abf18c5ad0b3664 Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Thu, 10 Oct 2024 13:18:22 +0200 Subject: [PATCH 1/2] notice changes to values fixes https://github.com/jasp-stats/INTERNAL-jasp/issues/2659 (computed columns not cascading) --- CommonData/column.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CommonData/column.cpp b/CommonData/column.cpp index 6e7ba2edb4..aac5224218 100644 --- a/CommonData/column.cpp +++ b/CommonData/column.cpp @@ -488,7 +488,8 @@ columnType Column::setValues(const stringvec & values, const stringvec & labels, for(size_t i=0; i Date: Thu, 10 Oct 2024 16:23:14 +0200 Subject: [PATCH 2/2] fix last bug and make code prettier --- Desktop/data/datasetpackage.cpp | 2 +- QMLComponents/boundcontrols/boundcontrolbase.cpp | 15 ++++++++------- QMLComponents/controls/textinputbase.cpp | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Desktop/data/datasetpackage.cpp b/Desktop/data/datasetpackage.cpp index 0c243b82e7..e0ddd0ef6e 100644 --- a/Desktop/data/datasetpackage.cpp +++ b/Desktop/data/datasetpackage.cpp @@ -2540,7 +2540,7 @@ Column * DataSetPackage::requestComputedColumnCreation(const std::string & colum bool DataSetPackage::requestColumnCreation(const std::string & columnName, Analysis * analysis, columnType type) { - if(DataSetPackage::pkg()->isColumnNameFree(columnName)) + if(!DataSetPackage::pkg()->isColumnNameFree(columnName)) return false; createComputedColumn(columnName, type, computedColumnType::analysisNotComputed, analysis); diff --git a/QMLComponents/boundcontrols/boundcontrolbase.cpp b/QMLComponents/boundcontrols/boundcontrolbase.cpp index dd18f307dd..4b5a0a3891 100644 --- a/QMLComponents/boundcontrols/boundcontrolbase.cpp +++ b/QMLComponents/boundcontrols/boundcontrolbase.cpp @@ -83,16 +83,17 @@ void BoundControlBase::handleComputedColumn(const Json::Value& value) std::string newName = value.asString(), orgName = orgValue.asString(); - if (newName.empty() && !orgName.empty()) - emit _control->requestComputedColumnDestruction(orgName); - - else if (newName != orgName) + if (newName != orgName) { - if (_isComputedColumn) emit _control->requestComputedColumnCreation(newName); - else emit _control->requestColumnCreation(newName, _columnType); - if (!orgName.empty()) emit _control->requestComputedColumnDestruction(orgName); + + if(!newName.empty()) + { + if (_isComputedColumn) emit _control->requestComputedColumnCreation(newName); + else emit _control->requestColumnCreation(newName, _columnType); + } + } } } diff --git a/QMLComponents/controls/textinputbase.cpp b/QMLComponents/controls/textinputbase.cpp index dc1be4a4d7..d33143609e 100644 --- a/QMLComponents/controls/textinputbase.cpp +++ b/QMLComponents/controls/textinputbase.cpp @@ -214,7 +214,8 @@ void TextInputBase::setUp() void TextInputBase::setDisplayValue() { - setProperty("displayValue", _value); + if(property("displayValue") != _value) + setProperty("displayValue", _value); } void TextInputBase::rScriptDoneHandler(const QString &result)