diff --git a/apply_guidance.ts b/apply_guidance.ts index 1bd97e5..7573e58 100644 --- a/apply_guidance.ts +++ b/apply_guidance.ts @@ -30,6 +30,20 @@ export function apply_guidance(doc: any) { return match ? match.adj : null; } + //-------------------------------set flor prices------------------------------- + function getFloor(stlc) { + switch (stlc) { + case "SDD10000": + return 0.045; + case "SDD10001": + return 0.045; + case "SDD12000": + return 0.065; + default: + return null; + } + } + function lowestPrice(priceObject) { let Price = Infinity; let Reason = ''; @@ -105,6 +119,7 @@ export function apply_guidance(doc: any) { let optReason = (optimization ?? 0) !== 0 ? ` + ${(optimization * 100).toFixed(1)}% opt`: ""; let custAddReason = `${inflReason}${ltpReason}${optReason}`; let markAddReason = `${inflReason}${ltpReason}`; + let floor = getFloor(stlc); // ------------------start building price options------------------------------------------------ @@ -130,6 +145,11 @@ export function apply_guidance(doc: any) { } let finalPrice = lowestPrice(prices); + if (floor && floor > finalPrice.Price) { + finalPrice.Price = floor; + finalPrice.Snapped = floor; + finalPrice.Reason = `${finalPrice.Reason} floor at ${floor}`; + } let guidance = { prices ,finalPrice