diff --git a/backend/datamart/datamart.controller.ts b/backend/datamart/datamart.controller.ts index ef24c9e..33c52a2 100644 --- a/backend/datamart/datamart.controller.ts +++ b/backend/datamart/datamart.controller.ts @@ -117,7 +117,7 @@ export const runDatamartQuery = async (data: Data) => { // for queries that will need to be ran on legacy until we get the plant updated need to go in here const doubleQueries = ["inventory"]; const sqlQuery = sqlQuerySelector( - `datamart.${fd.data[0].activated > 0 && !doubleQueries.includes(data.name) ? data.name : `legacy.${data.name}`}`, + `datamart.${fd.data[0].activated > 0 && doubleQueries.includes(data.name) ? data.name : `legacy.${data.name}`}`, ) as SqlQuery; // checking if warehousing is as it will start to effect a lot of queries for plants that are not on 2. @@ -201,10 +201,15 @@ export const runDatamartQuery = async (data: Data) => { "--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot", `${data.options.lots ? `,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot` : `--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber as lot`}`, ) + .replaceAll( + "--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber", + `${data.options.lots ? `,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber` : `--,l.MachineLocation,l.MachineName,l.ProductionLotRunningNumber`}`, + ) .replaceAll( "--,l.WarehouseDescription,l.LaneDescription", `${data.options.locations ? `,l.WarehouseDescription,l.LaneDescription` : `--,l.WarehouseDescription,l.LaneDescription`}`, ); + break; case "fakeEDIUpdate": datamartQuery = datamartQuery.replace(