Skip to content

Commit

Permalink
Adapt r code (#1562)
Browse files Browse the repository at this point in the history
* add reload after survey import

* changes in r and column names
  • Loading branch information
ramirobg94 authored Jul 6, 2021
1 parent 5a14da3 commit d4fdf95
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions common/surveyRdb/nodeDefTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion server/modules/analysis/service/rChain/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# remove all objects in session
rm(list = ls())
# rm(list = ls())
rm(list = ls(pattern="[^arenaLogin]"))
Original file line number Diff line number Diff line change
Expand Up @@ -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()')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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'`)
Expand Down

0 comments on commit d4fdf95

Please sign in to comment.