core: script: storageUsage: use single event

This commit is contained in:
undefined committed 2025-12-17 04:01:32 +08:00
1 parent 34f44fada1
commit b306bbd087
1 file changed
+12 -15
+12 -15
View File
@@ -11,21 +11,18 @@ export async function run(_, report) {
{ $match: { size: { $gt: 10 * 1024 * 1024 } } },
{ $sort: { size: -1 } },
]).toArray();
for (let i = 0; i < m.length; i++) {
const message = m[i]._id;
report({
case: {
id: i + 1,
message,
memory: Math.floor(m[i].size / 102.4) / 10,
time: 0,
status: STATUS.STATUS_ACCEPTED,
score: 0,
},
});
totalProblemSize += m[i].size;
}
report({ message: `Problem total ${totalProblemSize / 1024 / 1024} MB` });
const cases = m.map((val, i) => {
totalProblemSize += val.size;
return {
id: i + 1,
message: val._id,
memory: Math.floor(val.size / 102.4) / 10,
time: 0,
status: STATUS.STATUS_ACCEPTED,
score: 0,
};
});
report({ cases, message: `Problem total ${totalProblemSize / 1024 / 1024} MB` });
return true;
}