add floor price for cap dishes
This commit is contained in:
parent
50781c6b2f
commit
3050bbfe7a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user