fix(datamart): if we do not have 2.0 warehousing activate we need to use legacy
This commit is contained in:
@@ -95,7 +95,32 @@ export const runDatamartQuery = async (data: Data) => {
|
||||
notify: false,
|
||||
});
|
||||
}
|
||||
const sqlQuery = sqlQuerySelector(`datamart.${data.name}`) as SqlQuery;
|
||||
|
||||
const featureQ = sqlQuerySelector(`featureCheck`) as SqlQuery;
|
||||
|
||||
const { data: fd, error: fe } = await tryCatch(
|
||||
prodQuery(featureQ.query, `Running feature check`),
|
||||
);
|
||||
|
||||
if (fe) {
|
||||
return returnFunc({
|
||||
success: false,
|
||||
level: "error",
|
||||
module: "datamart",
|
||||
subModule: "query",
|
||||
message: `feature check failed`,
|
||||
data: fe as any,
|
||||
notify: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 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}`}`,
|
||||
) as SqlQuery;
|
||||
|
||||
// checking if warehousing is as it will start to effect a lot of queries for plants that are not on 2.
|
||||
|
||||
const getDataMartInfo = datamartData.filter((x) => x.endpoint === data.name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user