feat: get count of items
This commit is contained in:
@@ -256,14 +256,22 @@ router.post('/runs/run/:id', requireSignIn, async (req: AuthenticatedRequest, re
|
|||||||
let extractedScreenshotsCount = 0;
|
let extractedScreenshotsCount = 0;
|
||||||
let extractedItemsCount = 0;
|
let extractedItemsCount = 0;
|
||||||
|
|
||||||
if (run.dataValues.binaryOutput) {
|
if (run.dataValues.binaryOutput && run.dataValues.binaryOutput["item-0"]) {
|
||||||
extractedScreenshotsCount = run.dataValues.binaryOutput['item-0'].length;
|
extractedScreenshotsCount = 1;
|
||||||
}
|
|
||||||
if (run.dataValues.serializableOutput) {
|
|
||||||
extractedItemsCount = run.dataValues.serializableOutput['item-0'].length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`${extractedItemsCount} ${extractedScreenshotsCount}`)
|
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-manual',
|
'maxun-oss-run-created-manual',
|
||||||
@@ -272,6 +280,7 @@ router.post('/runs/run/:id', requireSignIn, async (req: AuthenticatedRequest, re
|
|||||||
user_id: req.user?.id,
|
user_id: req.user?.id,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
status: 'success',
|
status: 'success',
|
||||||
|
totalRowsExtracted,
|
||||||
extractedItemsCount,
|
extractedItemsCount,
|
||||||
extractedScreenshotsCount,
|
extractedScreenshotsCount,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user