feat: get count of items
This commit is contained in:
@@ -559,19 +559,34 @@ async function executeRun(id: string) {
|
|||||||
binaryOutput: uploadedBinaryOutput,
|
binaryOutput: uploadedBinaryOutput,
|
||||||
});
|
});
|
||||||
|
|
||||||
let totalRowsExtracted = 0;
|
let totalRowsExtracted = 0;
|
||||||
updatedRun.dataValues.serializableOutput['item-0'].forEach((item: any) => {
|
let extractedScreenshotsCount = 0;
|
||||||
totalRowsExtracted += Object.keys(item).length;
|
let extractedItemsCount = 0;
|
||||||
}
|
|
||||||
);
|
if (updatedRun.dataValues.binaryOutput && updatedRun.dataValues.binaryOutput["item-0"]) {
|
||||||
|
extractedScreenshotsCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updatedRun.dataValues.serializableOutput && updatedRun.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('maxun-oss-run-created-api',{
|
capture('maxun-oss-run-created-api',{
|
||||||
runId: id,
|
runId: id,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
status: 'success',
|
status: 'success',
|
||||||
extractedItemsCount: updatedRun.dataValues.serializableOutput['item-0'].length,
|
extractedItemsCount,
|
||||||
extractedRowsCount: totalRowsExtracted,
|
totalRowsExtracted,
|
||||||
extractedScreenshotsCount: updatedRun.dataValues.binaryOutput['item-0'].length,
|
extractedScreenshotsCount,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user