From 3a4d2a4763352d7b34b8aeb633e1433a3716aac7 Mon Sep 17 00:00:00 2001 From: martyncolmer Date: Wed, 7 Dec 2022 09:39:03 +0000 Subject: [PATCH] fix for Calc sum --- src/eq_schema/schema/Block/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/eq_schema/schema/Block/index.js b/src/eq_schema/schema/Block/index.js index 1d824d5b..e3aa59c0 100644 --- a/src/eq_schema/schema/Block/index.js +++ b/src/eq_schema/schema/Block/index.js @@ -21,6 +21,8 @@ const { DrivingQuestion, } = require("../../block-types/listCollector") +const { getValueSource } = require("../../builders/valueSource") + const pageTypeMappings = { QuestionPage: "Question", InterstitialPage: "Interstitial", @@ -91,7 +93,7 @@ class Block { this.type = "CalculatedSummary"; this.calculation = { calculation_type: "sum", - answers_to_calculate: page.summaryAnswers.map((o) => `answer${o}`), + answers_to_calculate: page.summaryAnswers.map((answerId) => getValueSource(ctx, answerId).identifier), title: processPipe(ctx)(page.totalTitle), }; }