From 2ebf6955261849bebc63a1818b3d08d75d2e0dbb Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Mon, 15 Jun 2026 17:16:29 -0500 Subject: [PATCH] fix(builds): fixed non used variables --- .../logistics.dm.forecast.map.loreal.ts | 77 +++++-------------- .../logistics.dm.forecast.map.pNg.ts | 4 +- 2 files changed, 22 insertions(+), 59 deletions(-) diff --git a/backend/logistics/logistics.dm.forecast.map.loreal.ts b/backend/logistics/logistics.dm.forecast.map.loreal.ts index 0f926e4..283bddb 100644 --- a/backend/logistics/logistics.dm.forecast.map.loreal.ts +++ b/backend/logistics/logistics.dm.forecast.map.loreal.ts @@ -6,7 +6,7 @@ import { sqlQuerySelector, } from "../prodSql/prodSqlQuerySelector.utils.js"; import { returnFunc } from "../utils/returnHelper.utils.js"; -import { sendEmail } from "../utils/sendEmail.utils.js"; +//import { sendEmail } from "../utils/sendEmail.utils.js"; import { tryCatch } from "../utils/trycatch.utils.js"; import { postData } from "./logistics.dm.postData.js"; @@ -83,7 +83,7 @@ export const lorealForecast = async (data: any, user: any) => { const article: any = a?.data; - console.log(article); + //console.log(article); // process the ebm forcast for (let i = 0; i < ebmForeCastData.length; i++) { @@ -127,31 +127,6 @@ export const lorealForecast = async (data: any, user: any) => { //console.log(ebmForeCastData.length); } - // petForeCastData.forEach((item: any, index: any) => { - // //console.log(`Processing item ${index + 1} of ${forecastData.length}`); - - // // Extract the customer code - // const customerCode = item["SOUTH PET BOTTLES"]; - - // // Process each date in the current object - // for (const [date, qty] of Object.entries(item)) { - // // Skip metadata fields - // if (petMetadataFields.includes(date)) continue; - - // if (qty === 0) continue; - - // // Create your transformed record - // const record = { - // customerArticleNo: customerCode, - // requirementDate: excelDateStuff(parseInt(date)), - // quantity: qty, - // }; - - // // Do something with this record - // petForecastData.push(record); - // } - // }); - // pet forecast for (let i = 0; i < petForeCastData.length; i++) { // bottle code @@ -200,25 +175,25 @@ export const lorealForecast = async (data: any, user: any) => { //console.log(comForecast); // email the for the missing ones - const missedGrouped = Object.values( - missingSku.reduce((acc: any, item: any) => { - const key = item.customerArticleNo; + // const missedGrouped = Object.values( + // missingSku.reduce((acc: any, item: any) => { + // const key = item.customerArticleNo; - if (!acc[key]) { - // first time we see this customer - acc[key] = item; - } else { - // compare dates and keep the earliest - if ( - new Date(item.requirementDate) < new Date(acc[key].requirementDate) - ) { - acc[key] = item; - } - } + // if (!acc[key]) { + // // first time we see this customer + // acc[key] = item; + // } else { + // // compare dates and keep the earliest + // if ( + // new Date(item.requirementDate) < new Date(acc[key].requirementDate) + // ) { + // acc[key] = item; + // } + // } - return acc; - }, {}), - ); + // return acc; + // }, {}), + // ); // TODO: change this to a flagged notification so that he users can subscribe or leave it. this removes the hardcody shit. // const emailSetup = { @@ -248,19 +223,7 @@ export const lorealForecast = async (data: any, user: any) => { const updatedPredefinedObject = { ...predefinedObject, - positions: [ - ...predefinedObject.positions, - ...ebmForecastData, - - // ...ebmForecastData.filter( - // (q: any) => - // q.customerArticleNo != "" && q.customerArticleNo != "Total" - // ), - // ...petForecastData.filter( - // (q: any) => - // q.customerArticleNo != "" && q.customerArticleNo != "Total" - // ), - ], + positions: [...predefinedObject.positions, ...ebmForecastData], }; // console.log(updatedPredefinedObject); diff --git a/backend/logistics/logistics.dm.forecast.map.pNg.ts b/backend/logistics/logistics.dm.forecast.map.pNg.ts index 436a67f..e4b14c9 100644 --- a/backend/logistics/logistics.dm.forecast.map.pNg.ts +++ b/backend/logistics/logistics.dm.forecast.map.pNg.ts @@ -113,8 +113,8 @@ export const pNgForecast = async (data: any, user: any) => { // } return { - customerArticleNo: parseInt(o["Customer Item No."]), - requirementDate: excelDateStuff(parseInt(o["Request Date"])), + customerArticleNo: parseInt(o["Customer Item No."] ?? "0", 10), + requirementDate: excelDateStuff(parseInt(o["Request Date"] ?? "0", 10)), quantity: o["Remaining Qty to be Shipped"], }; });