feat: get count of items

This commit is contained in:
karishmas6
2024-10-29 04:26:19 +05:30
parent 429304a324
commit 913095e950

View File

@@ -134,10 +134,25 @@ async function executeRun(id: string) {
}); });
let totalRowsExtracted = 0; let totalRowsExtracted = 0;
run.dataValues.serializableOutput['item-0'].forEach((item: any) => { let extractedScreenshotsCount = 0;
totalRowsExtracted += Object.keys(item).length; let extractedItemsCount = 0;
}
); if (run.dataValues.binaryOutput && run.dataValues.binaryOutput["item-0"]) {
extractedScreenshotsCount = 1;
}
if (run.dataValues.serializableOutput && run.dataValues.serializableOutput["item-0"]) {
const itemsArray = run.dataValues.serializableOutput["item-0"];
extractedItemsCount = itemsArray.length;
totalRowsExtracted = itemsArray.reduce((total, item) => {
return total + Object.keys(item).length;
}, 0);
}
console.log(`Extracted Items Count: ${extractedItemsCount}`);
console.log(`Extracted Screenshots Count: ${extractedScreenshotsCount}`);
console.log(`Total Rows Extracted: ${totalRowsExtracted}`);
capture( capture(
'maxun-oss-run-created-scheduled', 'maxun-oss-run-created-scheduled',
@@ -145,9 +160,9 @@ async function executeRun(id: string) {
runId: id, runId: id,
created_at: new Date().toISOString(), created_at: new Date().toISOString(),
status: 'success', status: 'success',
extractedItemsCount: run.dataValues.serializableOutput['item-0'].length, totalRowsExtracted,
extractedRowsCount: totalRowsExtracted, extractedItemsCount,
extractedScreenshotsCount: run.dataValues.binaryOutput['item-0'].length, extractedScreenshotsCount,
} }
); );