fix: case cell not found

Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
pakintada@gmail.com 2026-05-27 08:22:14 +07:00
parent 244a234833
commit 8b0479bf58

View file

@ -51,14 +51,19 @@ export function handleSheetResponseFromNoti(raw_payload: any, ref: string, count
// price idx should be last
let price_idx = header_idx[header_idx.length - 1];
let price_rows = c.payload;
if (!price_rows) {
continue;
}
// get last because last row will always override
let expected_row = price_rows[price_rows.length - 1];
if (expected_row.cells != undefined) {
if (expected_row != undefined && expected_row.cells != undefined) {
let price_col = expected_row.cells[price_idx];
products[curr_product_code] = price_col;
console.log(`[handleSheetPrice][country] ${curr_product_code} --> ${price_col}`);
} else {
console.log(`[handleSheetPrice][country] ${curr_product_code} not found cell`);
console.log(
`[handleSheetPrice][country] ${curr_product_code} not found cell, ${JSON.stringify(price_rows)}`
);
}
}