From 02a740d1025847ec7c23cfeaf1bd344fa914b986 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Tue, 4 Jun 2019 17:16:15 +0530 Subject: [PATCH] Trying to handle formula in the price field of the building block --- src/config/projectWizard/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/config/projectWizard/index.js b/src/config/projectWizard/index.js index 3edc546de..c9ed01533 100644 --- a/src/config/projectWizard/index.js +++ b/src/config/projectWizard/index.js @@ -618,6 +618,13 @@ export function getProductEstimate(projectTemplate, projectData) { if (isNaN(bbPrice)) { // if we are unable to parse price as numeric value, set it as ZERO bbPrice = 0 } + // stores back the evaluated price, if the price field contains the formula + if (_.isString(bb.price)) { + // stores the original formula in metadata + bb.metadata.priceFormula = bb.price + // updates the price with evaluated price + bb.price = bbPrice + } price += (bbPrice * (bb.quantity ? bb.quantity : 1)) minTime += bb.minTime maxTime += bb.maxTime