MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / fixProblem

Function fixProblem

packages/migrate/scripts/vijos.ts:332–345  ·  view source on GitHub ↗
(report: Report)

Source from the content-addressed store, hash-verified

330}
331
332async function fixProblem(report: Report) {
333 const count = await dst.collection('document').countDocuments({ docType: 10 });
334 await report({ progress: 1, message: `Fix pid: ${count}` });
335 const total = Math.floor(count / 50);
336 for (let i = 0; i <= total; i++) {
337 const docs = await dst.collection('document')
338 .find({ docType: 10 }).skip(i * 50).limit(50)
339 .toArray();
340 for (const doc of docs) {
341 await fix(doc).catch((e) => report({ message: `${e.toString()}\n${e.stack}` }));
342 }
343 await report({ progress: Math.round(100 * ((i + 1) / (total + 1))) });
344 }
345}
346
347function objid(ts: Date) {
348 const p = Math.floor(ts.getTime() / 1000).toString(16);

Callers 1

runFunction · 0.85

Calls 4

reportFunction · 0.85
fixFunction · 0.85
collectionMethod · 0.80
findMethod · 0.80

Tested by

no test coverage detected