Fix elapsed time calculation in import scripts

This commit is contained in:
2025-01-29 13:40:01 -05:00
parent 84baa7e7d3
commit 81a724db9d
3 changed files with 6 additions and 6 deletions

View File

@@ -134,7 +134,7 @@ async function importCategories(prodConnection, localConnection) {
operation: "Categories import", operation: "Categories import",
current: totalInserted, current: totalInserted,
total: totalInserted, total: totalInserted,
elapsed: formatElapsedTime(startTime), elapsed: formatElapsedTime((Date.now() - startTime) / 1000),
}); });
} }
@@ -152,7 +152,7 @@ async function importCategories(prodConnection, localConnection) {
operation: "Categories import completed", operation: "Categories import completed",
current: totalInserted, current: totalInserted,
total: totalInserted, total: totalInserted,
duration: formatElapsedTime(Date.now() - startTime), duration: formatElapsedTime((Date.now() - startTime) / 1000),
}); });
return { return {

View File

@@ -132,7 +132,7 @@ async function importOrders(prodConnection, localConnection) {
operation: "Orders import", operation: "Orders import",
current: processed, current: processed,
total, total,
elapsed: formatElapsedTime(startTime), elapsed: formatElapsedTime((Date.now() - startTime) / 1000),
remaining: estimateRemaining(startTime, processed, total), remaining: estimateRemaining(startTime, processed, total),
rate: calculateRate(startTime, processed) rate: calculateRate(startTime, processed)
}); });
@@ -218,7 +218,7 @@ async function importOrders(prodConnection, localConnection) {
operation: "Orders import completed", operation: "Orders import completed",
current: total, current: total,
total, total,
duration: formatElapsedTime(Date.now() - startTime), duration: formatElapsedTime((Date.now() - startTime) / 1000),
}); });
return { return {

View File

@@ -262,7 +262,7 @@ async function importPurchaseOrders(prodConnection, localConnection) {
operation: "Purchase orders import", operation: "Purchase orders import",
current: processed, current: processed,
total: totalItems, total: totalItems,
elapsed: formatElapsedTime(startTime), elapsed: formatElapsedTime((Date.now() - startTime) / 1000),
remaining: estimateRemaining(startTime, processed, totalItems), remaining: estimateRemaining(startTime, processed, totalItems),
rate: calculateRate(startTime, processed) rate: calculateRate(startTime, processed)
}); });
@@ -276,7 +276,7 @@ async function importPurchaseOrders(prodConnection, localConnection) {
operation: "Purchase orders import completed", operation: "Purchase orders import completed",
current: totalItems, current: totalItems,
total: totalItems, total: totalItems,
duration: formatElapsedTime(Date.now() - startTime), duration: formatElapsedTime((Date.now() - startTime) / 1000),
}); });
return { return {