Clean up from simplifying

This commit is contained in:
2025-02-02 15:41:57 -05:00
parent 7d16500f6f
commit 00c8e1b090
7 changed files with 6 additions and 111 deletions

View File

@@ -473,18 +473,6 @@ async function importOrders(prodConnection, localConnection, incrementalUpdate =
recordsAdded += inserts;
recordsUpdated += updates;
importedCount += processedOrderItems.size;
// Mark affected products for recalculation
const affectedPids = [...new Set(validOrders.map(o => o.pid))];
if (affectedPids.length > 0) {
await localConnection.query(`
INSERT INTO product_metric_status (pid, needs_recalculation)
VALUES ${affectedPids.map(() => '(?, TRUE)').join(',')}
ON DUPLICATE KEY UPDATE
needs_recalculation = TRUE,
updated_at = CURRENT_TIMESTAMP
`, affectedPids);
}
}
// Update progress based on unique orders processed
@@ -597,18 +585,6 @@ async function importOrders(prodConnection, localConnection, incrementalUpdate =
recordsAdded += inserts;
recordsUpdated += updates;
importedCount += retryOrderItems.size;
// Mark affected products for recalculation
const affectedPids = [...new Set(validOrders.map(o => o.pid))];
if (affectedPids.length > 0) {
await localConnection.query(`
INSERT INTO product_metric_status (pid, needs_recalculation)
VALUES ${affectedPids.map(() => '(?, TRUE)').join(',')}
ON DUPLICATE KEY UPDATE
needs_recalculation = TRUE,
updated_at = CURRENT_TIMESTAMP
`, affectedPids);
}
}
} catch (error) {
console.warn('Warning: Failed to retry skipped orders:', error.message);