From 90034749d070eb2c7004c16bc0a0b2762cbaba6f Mon Sep 17 00:00:00 2001 From: boutinb Date: Fri, 25 Oct 2024 18:54:51 +0200 Subject: [PATCH 1/3] Handle also paired variablesList The Bain Paired T-Tests is in preloadData mode, and should work. --- Common/jaspColumnEncoder | 2 +- .../boundcontrols/boundcontrolmultiterms.cpp | 41 +++++++++++++++++-- .../boundcontrols/boundcontrolmultiterms.h | 9 ++-- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Common/jaspColumnEncoder b/Common/jaspColumnEncoder index e219fb1198..094a53c3d8 160000 --- a/Common/jaspColumnEncoder +++ b/Common/jaspColumnEncoder @@ -1 +1 @@ -Subproject commit e219fb1198c657ed88d3fdf1e79930337df31cce +Subproject commit 094a53c3d8b3375bcb486ec2ded5843e15933291 diff --git a/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp b/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp index a07493dd2e..26b532ff1e 100644 --- a/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp +++ b/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp @@ -27,11 +27,13 @@ BoundControlMultiTerms::BoundControlMultiTerms(ListModelMultiTermsAssigned* list void BoundControlMultiTerms::bindTo(const Json::Value& value) { - BoundControlBase::bindTo(value); + Json::Value adjustedValue = _isValueWithTypes(value) ? value["value"] : value; + + BoundControlBase::bindTo(adjustedValue); std::vector > values; - for (const Json::Value& rowJson : value) + for (const Json::Value& rowJson : adjustedValue) { std::vector rowValues; if (rowJson.isArray()) @@ -54,7 +56,7 @@ Json::Value BoundControlMultiTerms::createJson() const bool BoundControlMultiTerms::isJsonValid(const Json::Value &optionValue) const { - return optionValue.type() == Json::arrayValue; + return optionValue.type() == Json::arrayValue || optionValue.type() == Json::objectValue; } void BoundControlMultiTerms::resetBoundValue() @@ -71,3 +73,36 @@ void BoundControlMultiTerms::resetBoundValue() setBoundValue(boundValue); } + +void BoundControlMultiTerms::setBoundValue(const Json::Value &value, bool emitChanges) +{ + Json::Value newValue; + + if (_control->encodeValue()) + { + if (_isValueWithTypes(value)) + newValue = value; + else + { + Json::Value types(Json::arrayValue); + std::string type = columnTypeToString(_listModel->listView()->defaultType()); + for (const Json::Value& row : value) + { + Json::Value rowType(Json::arrayValue); + if (row.isString()) + rowType.append(type); + else if (row.isArray()) + { + for (int i = 0; i < row.size(); i++) + rowType.append(type); + } + types.append(rowType); + } + newValue["value"] = value; + newValue["types"] = types; + } + } + + BoundControlBase::setBoundValue(newValue.isNull() ? value : newValue, emitChanges); + +} diff --git a/QMLComponents/boundcontrols/boundcontrolmultiterms.h b/QMLComponents/boundcontrols/boundcontrolmultiterms.h index f7fa41bbcc..90a1d18e36 100644 --- a/QMLComponents/boundcontrols/boundcontrolmultiterms.h +++ b/QMLComponents/boundcontrols/boundcontrolmultiterms.h @@ -28,10 +28,11 @@ class BoundControlMultiTerms : public BoundControlBase public: BoundControlMultiTerms(ListModelMultiTermsAssigned* listModel); - bool isJsonValid(const Json::Value& optionValue) const override; - Json::Value createJson() const override; - void bindTo(const Json::Value &value) override; - void resetBoundValue() override; + bool isJsonValid(const Json::Value& optionValue) const override; + Json::Value createJson() const override; + void bindTo(const Json::Value &value) override; + void resetBoundValue() override; + void setBoundValue(const Json::Value &value, bool emitChanges = true) override; private: From 16a035fc341deb7532d4ebbcbdc80f1c6c253a88 Mon Sep 17 00:00:00 2001 From: boutinb Date: Mon, 28 Oct 2024 10:26:04 +0100 Subject: [PATCH 2/3] Update jaspTestModule --- Modules/jaspTestModule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/jaspTestModule b/Modules/jaspTestModule index 4937eb1def..c27e076b5e 160000 --- a/Modules/jaspTestModule +++ b/Modules/jaspTestModule @@ -1 +1 @@ -Subproject commit 4937eb1def08c1621c200382cedef33846fcc1f5 +Subproject commit c27e076b5eb3e3c3b4699da44564281f64302991 From 8576aca2e8394bac2f85f4d11b51b80b98117145 Mon Sep 17 00:00:00 2001 From: bruno boutin Date: Tue, 29 Oct 2024 11:54:55 +0100 Subject: [PATCH 3/3] Update QMLComponents/boundcontrols/boundcontrolmultiterms.cpp Co-authored-by: Joris Goosen --- QMLComponents/boundcontrols/boundcontrolmultiterms.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp b/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp index 26b532ff1e..9effb8dc3b 100644 --- a/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp +++ b/QMLComponents/boundcontrols/boundcontrolmultiterms.cpp @@ -84,6 +84,7 @@ void BoundControlMultiTerms::setBoundValue(const Json::Value &value, bool emitCh newValue = value; else { + // Else we are loading from a jasp version before "preloadData" was on or var.types were added to the options Json::Value types(Json::arrayValue); std::string type = columnTypeToString(_listModel->listView()->defaultType()); for (const Json::Value& row : value)