vault backup: 2023-11-06 16:10:07

This commit is contained in:
Paul Trowbridge 2023-11-06 16:10:07 -05:00
parent 480cd9bc76
commit 17b3f64be5

View File

@ -1,38 +0,0 @@
--- old_apply_guidance.js
+++ new_apply_guidance.js
@@ -1,5 +1,6 @@
function apply_guidance(doc: any) {
let mostRelevantMarketPrice = null;
let mostRelevantMarketKey = null;
+ let earliestCustomerPriceSince2020 = null;
let highestMarketRelevanceLevel = -1;
let mostRelevantCustomerPrice = null;
@@ -20,6 +21,15 @@
let customerRelevance = 0; // Assume 0 is 'not relevant'
// ... (rest of the existing logic)
+
+ // Check for the earliest customer price since 2020
+ if (item.cust && item.last_season >= 2020) {
+ if (earliestCustomerPriceSince2020 === null || item.last_season < earliestCustomerPriceSince2020.season) {
+ earliestCustomerPriceSince2020 = {
+ price: item.last_price,
+ season: item.last_season
+ };
+ }
+ }
// ... (rest of the existing logic)
@@ -50,6 +60,10 @@
// ... (rest of the existing logic)
// Assign the most relevant customer price and key to the top level of the document
+ if (earliestCustomerPriceSince2020 !== null) {
+ doc.earliestCustomerPriceSince2020 = earliestCustomerPriceSince2020;
+ }
+
if (mostRelevantCustomerPrice !== null) {
doc.mostRelevantCustomerPriceInfo = {
price: mostRelevantCustomerPrice,