From 8a746aa42c4708f1ecc6633d517d0d0a1016640a Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 10 Nov 2023 10:09:38 -0500 Subject: [PATCH] vault backup: 2023-11-10 10:09:38 --- apply_guidance.ts | 5 +---- sql/db_apply.pg.sql | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 sql/db_apply.pg.sql diff --git a/apply_guidance.ts b/apply_guidance.ts index caa3d87..ef704fc 100644 --- a/apply_guidance.ts +++ b/apply_guidance.ts @@ -122,16 +122,13 @@ export function apply_guidance(doc: any) { // Determine the anchor price and source if (doc.hist.cust?.early_price !== undefined ) { if (doc.hist.cust.relevance !== 'customer exact') { + // translate alternate product history to current product quoted doc.anchorPrice = Number((doc.hist.cust.early_price * doc.bridgePremium).toFixed(5)); if (doc.targetPrice < doc.anchorPrice) { doc.anchorPrice = doc.targetPrice; doc.anchorSource = 'Target Price' } else { doc.anchorSource = doc.hist.cust.early_season + ' Similar (' + doc.hist.cust.ds + ') Customer Price ' + doc.hist.cust.early_price + ' x ' + doc.bridgePremium + ' = ' + doc.anchorPrice; - if (doc.targetPrice < doc.anchorPrice) { - doc.anchorSource = 'Target Price'; - doc.anchorPrice = doc.targetPrice; - } } } else { doc.anchorPrice = doc.hist.cust.early_price; diff --git a/sql/db_apply.pg.sql b/sql/db_apply.pg.sql new file mode 100644 index 0000000..9833bed --- /dev/null +++ b/sql/db_apply.pg.sql @@ -0,0 +1,5 @@ +SELECT + rlarp.get_guidance(lq.billto, lq.shipto, lq.part, lq.units_each, 2024) +FROM + pricequote.live_quotes lq +LIMIT 100