Skip to content

Commit 02a740d

Browse files
author
Vikas Agarwal
committed
Trying to handle formula in the price field of the building block
1 parent 1731323 commit 02a740d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/config/projectWizard/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,13 @@ export function getProductEstimate(projectTemplate, projectData) {
618618
if (isNaN(bbPrice)) { // if we are unable to parse price as numeric value, set it as ZERO
619619
bbPrice = 0
620620
}
621+
// stores back the evaluated price, if the price field contains the formula
622+
if (_.isString(bb.price)) {
623+
// stores the original formula in metadata
624+
bb.metadata.priceFormula = bb.price
625+
// updates the price with evaluated price
626+
bb.price = bbPrice
627+
}
621628
price += (bbPrice * (bb.quantity ? bb.quantity : 1))
622629
minTime += bb.minTime
623630
maxTime += bb.maxTime

0 commit comments

Comments
 (0)