core: fix testdata zip upload

This commit is contained in:
undefined committed 2021-03-29 23:02:59 +08:00
1 parent 777d648f63
commit b833efc8c9
4 files changed
+16 -2

No files matched your search

+11
View File
@@ -232,6 +232,17 @@ const scripts: UpgradeScript[] = [
await db.collection('domain.user').deleteMany({ uid: null });
await db.collection('domain.user').deleteMany({ uid: 0 });
},
async function _15_16() {
const _FRESH_INSTALL_IGNORE = 1;
await iterateAllProblem(['data', 'additional_file'], async (pdoc) => {
const $set: any = {};
const td = pdoc.data.filter((f) => f.name);
if (JSON.stringify(td) !== JSON.stringify(pdoc.data)) $set.data = td;
const af = pdoc.additional_file.filter((f) => f.name);
if (JSON.stringify(af) !== JSON.stringify(pdoc.additional_file)) $set.additional_file = af;
if (Object.keys($set).length) await problem.edit(pdoc.domainId, pdoc.docId, $set);
});
},
];
export = scripts;