vault backup: 2023-11-10 10:09:38

This commit is contained in:
Paul Trowbridge 2023-11-10 10:09:38 -05:00
parent 1250c671e7
commit 8a746aa42c
2 changed files with 6 additions and 4 deletions

View File

@ -122,16 +122,13 @@ export function apply_guidance(doc: any) {
// Determine the anchor price and source // Determine the anchor price and source
if (doc.hist.cust?.early_price !== undefined ) { if (doc.hist.cust?.early_price !== undefined ) {
if (doc.hist.cust.relevance !== 'customer exact') { 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)); doc.anchorPrice = Number((doc.hist.cust.early_price * doc.bridgePremium).toFixed(5));
if (doc.targetPrice < doc.anchorPrice) { if (doc.targetPrice < doc.anchorPrice) {
doc.anchorPrice = doc.targetPrice; doc.anchorPrice = doc.targetPrice;
doc.anchorSource = 'Target Price' doc.anchorSource = 'Target Price'
} else { } 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; 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 { } else {
doc.anchorPrice = doc.hist.cust.early_price; doc.anchorPrice = doc.hist.cust.early_price;

5
sql/db_apply.pg.sql Normal file
View File

@ -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