Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types in formula #5728

Merged
merged 6 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Modules/jaspAudit
2 changes: 1 addition & 1 deletion Modules/jaspBFF
2 changes: 1 addition & 1 deletion Modules/jaspBain
Submodule jaspBain updated 2 files
+5 −5 po/R-es.po
+5 −5 po/R-gl.po
2 changes: 1 addition & 1 deletion Modules/jaspMetaAnalysis
Submodule jaspMetaAnalysis updated 45 files
+2 −2 R/classicalmetaanalysiscommon.R
+2 −2 R/classicalmetaanalysismultilevelmultivariate.R
+1 −1 R/effectsizecomputation.R
+6 −6 R/funnelplot.R
+ inst/po/en@quot/LC_MESSAGES/R-jaspMetaAnalysis.mo
+ inst/po/es/LC_MESSAGES/R-jaspMetaAnalysis.mo
+ inst/po/ja/LC_MESSAGES/R-jaspMetaAnalysis.mo
+ inst/po/pl/LC_MESSAGES/R-jaspMetaAnalysis.mo
+ inst/po/pt/LC_MESSAGES/R-jaspMetaAnalysis.mo
+ inst/qml/translations/jaspMetaAnalysis-de.qm
+ inst/qml/translations/jaspMetaAnalysis-es.qm
+ inst/qml/translations/jaspMetaAnalysis-fr.qm
+ inst/qml/translations/jaspMetaAnalysis-gl.qm
+ inst/qml/translations/jaspMetaAnalysis-id.qm
+ inst/qml/translations/jaspMetaAnalysis-ja.qm
+ inst/qml/translations/jaspMetaAnalysis-nl.qm
+ inst/qml/translations/jaspMetaAnalysis-pl.qm
+ inst/qml/translations/jaspMetaAnalysis-pt.qm
+ inst/qml/translations/jaspMetaAnalysis-tr.qm
+ inst/qml/translations/jaspMetaAnalysis-zh_Hans.qm
+ inst/qml/translations/jaspMetaAnalysis-zh_Hant.qm
+3,021 −160 po/QML-de.po
+2,961 −160 po/QML-eo.po
+3,019 −160 po/QML-es.po
+2,966 −160 po/QML-fr.po
+3,020 −160 po/QML-gl.po
+2,989 −161 po/QML-id.po
+2,961 −160 po/QML-it.po
+3,018 −160 po/QML-ja.po
+2,961 −160 po/QML-jaspMetaAnalysis.pot
+3,018 −160 po/QML-nl.po
+3,010 −160 po/QML-pl.po
+2,973 −160 po/QML-pt.po
+2,961 −160 po/QML-pt_BR.po
+2,961 −160 po/QML-ru.po
+2,971 −161 po/QML-tr.po
+2,983 −169 po/QML-zh_Hans.po
+3,014 −160 po/QML-zh_Hant.po
+502 −77 po/R-ar.po
+770 −146 po/R-es.po
+766 −148 po/R-ja.po
+455 −77 po/R-jaspMetaAnalysis.pot
+578 −98 po/R-pl.po
+601 −109 po/R-pt.po
+502 −77 po/R-ru.po
2 changes: 1 addition & 1 deletion Modules/jaspSem
7 changes: 7 additions & 0 deletions QMLComponents/analysisform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ void AnalysisForm::runScriptRequestDone(const QString& result, const QString& co
clearFormErrors();
if (_rSyntax->parseRSyntaxOptions(options))
{
blockValueChangeSignal(true);
_analysis->clearOptions();
bindTo(Json::nullValue);
bindTo(options);
blockValueChangeSignal(false, false);
_analysis->boundValueChangedHandler();
}
}
Expand Down Expand Up @@ -310,6 +314,9 @@ QString AnalysisForm::msgsListToString(const QStringList & list) const
if(list.length() == 0)
return "";

if (list.size() == 1)
return list[0];

QString text;
for (const QString & msg : list)
if(msg.size())
Expand Down
51 changes: 6 additions & 45 deletions QMLComponents/boundcontrols/boundcontrolbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,12 @@ void BoundControlBase::_readTableValue(const Json::Value &value, const std::stri
{
for (const Json::Value& row : value)
{
std::vector<std::string> term;
const Json::Value& keyValue = row[key];
if (keyValue.isArray())
{
for (const Json::Value& component : keyValue)
term.push_back(component.asString());
}
else if (keyValue.isString())
term.push_back(keyValue.asString());
else
Log::log() << "Key (" << key << ") bind value is not an array or a string in " << getName() << ": " << value.toStyledString() << std::endl;
Json::Value keyValue = row[key];

Term term = Term::readTerm(keyValue);
if (term.size() > 0)
{
terms.add(Term(term));
terms.add(term);

QMap<QString, Json::Value> controlMap;
for (auto itr = row.begin(); itr != row.end(); ++itr)
Expand All @@ -145,7 +136,7 @@ void BoundControlBase::_readTableValue(const Json::Value &value, const std::stri
controlMap[tq(name)] = *itr;
}

allControlValues[Term(term).asQString()] = controlMap;
allControlValues[term.asQString()] = controlMap;
}
}
}
Expand All @@ -158,39 +149,9 @@ Json::Value BoundControlBase::_getTableValueOption(const Terms& terms, const Lis
{
QMap<QString, Json::Value> componentValues = componentValuesMap[term.asQString()];

Json::Value rowValues(Json::objectValue),
keyValue; // depending of keyHasVariables & hasInteraction, keyValue can be an object, an array or a string

if (keyHasVariables)
{
// If the key of the row contains variables, set 'value' and 'types'
Json::Value jsonValue, jsonTypes;

if (hasInteraction)
{
for (const std::string& comp : term.scomponents())
jsonValue.append(comp);
for (columnType type : term.types())
jsonTypes.append(columnTypeToString(type));
}
else
{
jsonValue = term.asString();
jsonTypes = columnTypeToString(term.type());
}
keyValue["value"] = jsonValue;
keyValue["types"] = jsonTypes;
}
else
{
if (hasInteraction)
for (const std::string& comp : term.scomponents())
keyValue.append(comp);
else
keyValue = term.asString();
}
Json::Value rowValues(Json::objectValue);

rowValues[key] = keyValue;
rowValues[key] = term.toJson(hasInteraction, keyHasVariables);

QMapIterator<QString, Json::Value> it2(componentValues);
while (it2.hasNext())
Expand Down
2 changes: 1 addition & 1 deletion QMLComponents/boundcontrols/boundcontrolbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BoundControlBase : public BoundControl
std::string getName() const;
void handleComputedColumn(const Json::Value& value);

Json::Value _getTableValueOption(const Terms& terms, const ListModel::RowControlsValues& componentValuesMap, const std::string& key, bool hasInteraction, bool keyHasVariables);
static Json::Value _getTableValueOption(const Terms& terms, const ListModel::RowControlsValues& componentValuesMap, const std::string& key, bool hasInteraction, bool keyHasVariables);
void _setTableValue(const Terms& terms, const ListModel::RowControlsValues& componentValuesMap, const std::string& key, bool hasInteraction, bool keyHasVariables = false);

void _readTableValue(const Json::Value& value, const std::string& key, bool hasMultipleTerms, Terms& terms, ListModel::RowControlsValues& allControlValues);
Expand Down
2 changes: 1 addition & 1 deletion QMLComponents/boundcontrols/boundcontrollayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool BoundControlLayers::isJsonValid(const Json::Value &optionValue) const
{
const Json::Value& nameOption = value["name"];
const Json::Value& variablesOption = value["variables"];
valid = nameOption.type() == Json::stringValue && variablesOption.type() == Json::arrayValue;
valid = nameOption.type() == Json::stringValue && (variablesOption.type() == Json::arrayValue || variablesOption.type() == Json::stringValue);

if (!valid)
break;
Expand Down
Loading
Loading