diff --git a/core/survey/_survey/surveyAnalysis.js b/core/survey/_survey/surveyAnalysis.js index 5ad2fe57ae..491748ce42 100644 --- a/core/survey/_survey/surveyAnalysis.js +++ b/core/survey/_survey/surveyAnalysis.js @@ -10,10 +10,9 @@ export const getAnalysisNodeDefs = let nodeDefs = SurveyNodeDefs.getNodeDefsArray(survey).filter(NodeDef.isAnalysis) if (chain) { - nodeDefs = nodeDefs.filter( - (nodeDef) => - NodeDef.getPropOrDraftAdvanced(NodeDef.keysPropsAdvanced.chainUuid)(nodeDef) === Chain.getUuid(chain) - ) + nodeDefs = nodeDefs.filter((nodeDef) => { + return NodeDef.getPropOrDraftAdvanced(NodeDef.keysPropsAdvanced.chainUuid)(nodeDef) === Chain.getUuid(chain) + }) } if (entity) { diff --git a/server/modules/analysis/service/rChain/index.js b/server/modules/analysis/service/rChain/index.js index 05999d06d5..03fa52b95b 100644 --- a/server/modules/analysis/service/rChain/index.js +++ b/server/modules/analysis/service/rChain/index.js @@ -25,7 +25,12 @@ export const generateScript = async ({ surveyId, cycle, chainUuid, serverUrl }) // ==== READ export const fetchEntityData = async ({ surveyId, cycle, entityDefUuid }) => { - const surveyAndNodeDefs = await SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId, cycle }) + const surveyAndNodeDefs = await SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ + surveyId, + cycle, + advanced: true, + draft: true, + }) const query = Query.create({ entityDefUuid }) @@ -35,7 +40,7 @@ export const fetchEntityData = async ({ surveyId, cycle, entityDefUuid }) => { // ==== UPDATE export const persistResults = async ({ surveyId, cycle, entityDefUuid, chainUuid, filePath }) => { - const survey = await SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId, cycle }) + const survey = await SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId, cycle, advanced: true, draft: true }) const chain = await AnalysisManager.fetchChain({ surveyId, chainUuid, @@ -93,7 +98,7 @@ export const persistUserScripts = async ({ user, surveyId, chainUuid, filePath } const [chain, survey] = await Promise.all([ AnalysisManager.fetchChain({ surveyId, chainUuid, includeScript: true }, tx), - SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId }), + SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId, advanced: true, draft: true }), ]) const { root } = Survey.getHierarchy()(survey) diff --git a/server/modules/analysis/service/rChain/rChain.js b/server/modules/analysis/service/rChain/rChain.js index b0ad936c2f..6c762d7994 100644 --- a/server/modules/analysis/service/rChain/rChain.js +++ b/server/modules/analysis/service/rChain/rChain.js @@ -136,7 +136,12 @@ class RChain { } async _initSurveyAndChain() { - this._survey = await SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId: this.surveyId, cycle: this.cycle }) + this._survey = await SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ + surveyId: this.surveyId, + cycle: this.cycle, + advanced: true, + draft: true, + }) const categories = await CategoryManager.fetchCategoriesAndLevelsBySurveyId({ surveyId: this.surveyId }) this._survey = Survey.assocCategories(categories)(this.survey) diff --git a/server/modules/survey/service/publish/jobs/chainsValidationJob.js b/server/modules/survey/service/publish/jobs/chainsValidationJob.js index 26ee0d538e..afc8bd81fd 100644 --- a/server/modules/survey/service/publish/jobs/chainsValidationJob.js +++ b/server/modules/survey/service/publish/jobs/chainsValidationJob.js @@ -16,7 +16,7 @@ export default class ChainsValidationJob extends Job { const { surveyId, tx } = this const [survey, chains] = await Promise.all([ - SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId, draft: true }, tx), + SurveyManager.fetchSurveyAndNodeDefsBySurveyId({ surveyId, draft: true, advanced: true }, tx), AnalysisManager.fetchChains({ surveyId }, tx), ])