diff --git a/common/surveyRdb/nodeDefTable.js b/common/surveyRdb/nodeDefTable.js index deae128591..b0d14ee193 100644 --- a/common/surveyRdb/nodeDefTable.js +++ b/common/surveyRdb/nodeDefTable.js @@ -39,10 +39,13 @@ export const getColumnNames = (nodeDef) => { export const getColumnName = R.pipe(getColumnNames, R.head) export const getNodeDefsWithColumnNames = (nodeDefs) => - nodeDefs.flatMap((nodeDef) => ({ columnName: getColumnNames(nodeDef), nodeDef })) + nodeDefs.flatMap((nodeDef) => { + const columnNames = getColumnNames(nodeDef) + return columnNames.map((colName) => ({ columnName: colName, nodeDef })) + }) export const getNodeDefsColumnNames = (nodeDefs) => - getNodeDefsWithColumnNames(nodeDefs).map(({ columnName }) => columnName) + getNodeDefsWithColumnNames(nodeDefs).flatMap(({ columnName }) => columnName) export const getNodeDefsByColumnNames = (nodeDefs) => getNodeDefsWithColumnNames(nodeDefs).reduce( diff --git a/server/modules/analysis/service/rChain/index.js b/server/modules/analysis/service/rChain/index.js index 03fa52b95b..efcc2176a0 100644 --- a/server/modules/analysis/service/rChain/index.js +++ b/server/modules/analysis/service/rChain/index.js @@ -57,7 +57,6 @@ export const persistResults = async ({ surveyId, cycle, entityDefUuid, chainUuid // Insert node results const massiveUpdateData = new SurveyRdbManager.MassiveUpdateData({ survey, entity, chain, chainUuid, cycle }, tx) - const massiveUpdateNodes = new SurveyRdbManager.MassiveUpdateNodes( { survey, surveyId, entity, chain, chainUuid, cycle }, tx diff --git a/server/modules/analysis/service/rChain/rFile/system/init-api.R b/server/modules/analysis/service/rChain/rFile/system/init-api.R index cf7079b5f6..13ffde17d1 100644 --- a/server/modules/analysis/service/rChain/rFile/system/init-api.R +++ b/server/modules/analysis/service/rChain/rFile/system/init-api.R @@ -70,8 +70,10 @@ arena.login = function(tentative) { arena.login(tentative + 1) } else { stop(respParsed$message) + return(FALSE) } } else { print(paste('User', user, 'succesfully logged in', sep = ' ')) + return(TRUE) } } diff --git a/server/modules/analysis/service/rChain/rFile/system/init-session.R b/server/modules/analysis/service/rChain/rFile/system/init-session.R index 02891b1aef..ead146f84d 100644 --- a/server/modules/analysis/service/rChain/rFile/system/init-session.R +++ b/server/modules/analysis/service/rChain/rFile/system/init-session.R @@ -1,2 +1,3 @@ # remove all objects in session -rm(list = ls()) +# rm(list = ls()) +rm(list = ls(pattern="[^arenaLogin]")) diff --git a/server/modules/analysis/service/rChain/rFile/system/rFileLogin.js b/server/modules/analysis/service/rChain/rFile/system/rFileLogin.js index 9730a8193a..f17ef4ed3f 100644 --- a/server/modules/analysis/service/rChain/rFile/system/rFileLogin.js +++ b/server/modules/analysis/service/rChain/rFile/system/rFileLogin.js @@ -8,6 +8,7 @@ export default class RFileLogin extends RFileSystem { async init() { await super.init() - await this.appendContent('arena.login()') + await this.appendContent('if (!exists("arenaLogin")) arenaLogin=FALSE') + await this.appendContent('if (arenaLogin==FALSE) arenaLogin = arena.login()') } } diff --git a/server/modules/analysis/service/rChain/rFile/system/rFilePersistResults.js b/server/modules/analysis/service/rChain/rFile/system/rFilePersistResults.js index 5bd74de6c3..1727fba88e 100644 --- a/server/modules/analysis/service/rChain/rFile/system/rFilePersistResults.js +++ b/server/modules/analysis/service/rChain/rFile/system/rFilePersistResults.js @@ -30,7 +30,6 @@ function* initPersistChainEntitiesResults() { for (let i = 0; i < entities.length; i += 1) { const entity = entities[i] - // TODO FIX to persist changes on scripts const dfResults = new DfResults(this.rChain, entity) yield this.logInfo(`'Uploading results for entity ${dfResults.dfSourceName} started'`)